|
|
@ -173,25 +173,28 @@ namespace data |
|
|
|
|
|
|
|
|
|
|
|
void NetDbRequests::RequestComplete (const IdentHash& ident, std::shared_ptr<RouterInfo> r) |
|
|
|
void NetDbRequests::RequestComplete (const IdentHash& ident, std::shared_ptr<RouterInfo> r) |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::shared_ptr<RequestedDestination> request; |
|
|
|
GetIOService ().post ([this, ident, r]() |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::unique_lock<std::mutex> l(m_RequestedDestinationsMutex); |
|
|
|
std::shared_ptr<RequestedDestination> request; |
|
|
|
auto it = m_RequestedDestinations.find (ident); |
|
|
|
{ |
|
|
|
if (it != m_RequestedDestinations.end ()) |
|
|
|
std::unique_lock<std::mutex> l(m_RequestedDestinationsMutex); |
|
|
|
{ |
|
|
|
auto it = m_RequestedDestinations.find (ident); |
|
|
|
request = it->second; |
|
|
|
if (it != m_RequestedDestinations.end ()) |
|
|
|
if (request->IsExploratory ()) |
|
|
|
{ |
|
|
|
m_RequestedDestinations.erase (it); |
|
|
|
request = it->second; |
|
|
|
// otherwise cache for a while
|
|
|
|
if (request->IsExploratory ()) |
|
|
|
} |
|
|
|
m_RequestedDestinations.erase (it); |
|
|
|
} |
|
|
|
// otherwise cache for a while
|
|
|
|
if (request) |
|
|
|
} |
|
|
|
{ |
|
|
|
} |
|
|
|
if (r) |
|
|
|
if (request) |
|
|
|
request->Success (r); |
|
|
|
{ |
|
|
|
else |
|
|
|
if (r) |
|
|
|
request->Fail (); |
|
|
|
request->Success (r); |
|
|
|
} |
|
|
|
else |
|
|
|
|
|
|
|
request->Fail (); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<RequestedDestination> NetDbRequests::FindRequest (const IdentHash& ident) const |
|
|
|
std::shared_ptr<RequestedDestination> NetDbRequests::FindRequest (const IdentHash& ident) const |
|
|
|