Browse Source

check for pending LeaseSet request

pull/147/head
orignal 10 years ago
parent
commit
c61ed150b7
  1. 18
      Destination.cpp

18
Destination.cpp

@ -464,13 +464,23 @@ namespace client
{ {
LeaseSetRequest * request = new LeaseSetRequest (m_Service); LeaseSetRequest * request = new LeaseSetRequest (m_Service);
request->requestComplete = requestComplete; request->requestComplete = requestComplete;
m_LeaseSetRequests[dest] = request; auto ret = m_LeaseSetRequests.insert (std::pair<i2p::data::IdentHash, LeaseSetRequest *>(dest,request));
if (!SendLeaseSetRequest (dest, floodfill, request)) if (ret.second) // inserted
{ {
// request failed if (!SendLeaseSetRequest (dest, floodfill, request))
{
// request failed
if (request->requestComplete) request->requestComplete (false);
delete request;
m_LeaseSetRequests.erase (dest);
}
}
else // duplicate
{
LogPrint (eLogError, "Request of ", dest.ToBase64 (), " is pending already");
// TODO: queue up requests
if (request->requestComplete) request->requestComplete (false); if (request->requestComplete) request->requestComplete (false);
delete request; delete request;
m_LeaseSetRequests.erase (dest);
} }
} }
else else

Loading…
Cancel
Save