mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
correct termination of pending leaseset
This commit is contained in:
parent
248992b27b
commit
565f844b7f
|
@ -527,13 +527,15 @@ namespace client
|
|||
{
|
||||
auto request = std::make_shared<LeaseSetRequest> (m_Service);
|
||||
request->requestComplete.push_back (requestComplete);
|
||||
auto ts = i2p::util::GetSecondsSinceEpoch ();
|
||||
auto ret = m_LeaseSetRequests.insert (std::pair<i2p::data::IdentHash, std::shared_ptr<LeaseSetRequest> >(dest,request));
|
||||
if (ret.second) // inserted
|
||||
{
|
||||
request->requestTime = ts;
|
||||
if (!SendLeaseSetRequest (dest, floodfill, request))
|
||||
{
|
||||
// request failed
|
||||
m_LeaseSetRequests.erase (dest);
|
||||
m_LeaseSetRequests.erase (ret.first);
|
||||
requestComplete (nullptr);
|
||||
}
|
||||
}
|
||||
|
@ -542,6 +544,8 @@ namespace client
|
|||
LogPrint (eLogInfo, "Destination: Request of LeaseSet ", dest.ToBase64 (), " is pending already");
|
||||
// TODO: implement it properly
|
||||
//ret.first->second->requestComplete.push_back (requestComplete);
|
||||
if (ts > ret.first->second->requestTime + MAX_LEASESET_REQUEST_TIMEOUT)
|
||||
m_LeaseSetRequests.erase (ret.first);
|
||||
requestComplete (nullptr);
|
||||
}
|
||||
}
|
||||
|
@ -565,7 +569,6 @@ namespace client
|
|||
if (request->replyTunnel && request->outboundTunnel)
|
||||
{
|
||||
request->excluded.insert (nextFloodfill->GetIdentHash ());
|
||||
request->requestTime = i2p::util::GetSecondsSinceEpoch ();
|
||||
request->requestTimeoutTimer.cancel ();
|
||||
|
||||
uint8_t replyKey[32], replyTag[32];
|
||||
|
|
Loading…
Reference in a new issue