mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-11 21:47:52 +00:00
report about termination after actual processing
This commit is contained in:
parent
7847982a57
commit
446e5fd665
@ -443,9 +443,10 @@ namespace client
|
|||||||
found = success;
|
found = success;
|
||||||
newDataReceived.notify_all ();
|
newDataReceived.notify_all ();
|
||||||
});
|
});
|
||||||
newDataReceived.wait (l);
|
if (newDataReceived.wait_for (l, std::chrono::seconds (SUBSCRIPTION_REQUEST_TIMEOUT)) == std::cv_status::timeout)
|
||||||
|
LogPrint (eLogError, "Subscription LeseseSet request timeout expired");
|
||||||
if (found)
|
if (found)
|
||||||
leaseSet = i2p::client::context.GetSharedLocalDestination ()->FindLeaseSet (ident);
|
leaseSet = i2p::client::context.GetSharedLocalDestination ()->FindLeaseSet (ident);
|
||||||
}
|
}
|
||||||
if (leaseSet)
|
if (leaseSet)
|
||||||
{
|
{
|
||||||
@ -476,7 +477,8 @@ namespace client
|
|||||||
},
|
},
|
||||||
30); // wait for 30 seconds
|
30); // wait for 30 seconds
|
||||||
std::unique_lock<std::mutex> l(newDataReceivedMutex);
|
std::unique_lock<std::mutex> l(newDataReceivedMutex);
|
||||||
newDataReceived.wait (l);
|
if (newDataReceived.wait_for (l, std::chrono::seconds (SUBSCRIPTION_REQUEST_TIMEOUT)) == std::cv_status::timeout)
|
||||||
|
LogPrint (eLogError, "Subscription timeout expired");
|
||||||
}
|
}
|
||||||
// process remaining buffer
|
// process remaining buffer
|
||||||
while (size_t len = stream->ReadSome (buf, 4096))
|
while (size_t len = stream->ReadSome (buf, 4096))
|
||||||
|
@ -22,6 +22,7 @@ namespace client
|
|||||||
const int INITIAL_SUBSCRIPTION_RETRY_TIMEOUT = 1; // in minutes
|
const int INITIAL_SUBSCRIPTION_RETRY_TIMEOUT = 1; // in minutes
|
||||||
const int CONTINIOUS_SUBSCRIPTION_UPDATE_TIMEOUT = 240; // in minutes
|
const int CONTINIOUS_SUBSCRIPTION_UPDATE_TIMEOUT = 240; // in minutes
|
||||||
const int CONTINIOUS_SUBSCRIPTION_RETRY_TIMEOUT = 5; // in minutes
|
const int CONTINIOUS_SUBSCRIPTION_RETRY_TIMEOUT = 5; // in minutes
|
||||||
|
const int SUBSCRIPTION_REQUEST_TIMEOUT = 60; //in second
|
||||||
|
|
||||||
class AddressBookStorage // interface for storage
|
class AddressBookStorage // interface for storage
|
||||||
{
|
{
|
||||||
|
@ -208,14 +208,6 @@ namespace client
|
|||||||
void ClientDestination::HandleDatabaseStoreMessage (const uint8_t * buf, size_t len)
|
void ClientDestination::HandleDatabaseStoreMessage (const uint8_t * buf, size_t len)
|
||||||
{
|
{
|
||||||
I2NPDatabaseStoreMsg * msg = (I2NPDatabaseStoreMsg *)buf;
|
I2NPDatabaseStoreMsg * msg = (I2NPDatabaseStoreMsg *)buf;
|
||||||
auto it1 = m_LeaseSetRequests.find (msg->key);
|
|
||||||
if (it1 != m_LeaseSetRequests.end ())
|
|
||||||
{
|
|
||||||
it1->second->requestTimeoutTimer.cancel ();
|
|
||||||
if (it1->second->requestComplete) it1->second->requestComplete (true);
|
|
||||||
delete it1->second;
|
|
||||||
m_LeaseSetRequests.erase (it1);
|
|
||||||
}
|
|
||||||
size_t offset = sizeof (I2NPDatabaseStoreMsg);
|
size_t offset = sizeof (I2NPDatabaseStoreMsg);
|
||||||
if (msg->replyToken) // TODO:
|
if (msg->replyToken) // TODO:
|
||||||
offset += 36;
|
offset += 36;
|
||||||
@ -236,6 +228,15 @@ namespace client
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
LogPrint (eLogError, "Unexpected client's DatabaseStore type ", msg->type, ". Dropped");
|
LogPrint (eLogError, "Unexpected client's DatabaseStore type ", msg->type, ". Dropped");
|
||||||
|
|
||||||
|
auto it1 = m_LeaseSetRequests.find (msg->key);
|
||||||
|
if (it1 != m_LeaseSetRequests.end ())
|
||||||
|
{
|
||||||
|
it1->second->requestTimeoutTimer.cancel ();
|
||||||
|
if (it1->second->requestComplete) it1->second->requestComplete (true);
|
||||||
|
delete it1->second;
|
||||||
|
m_LeaseSetRequests.erase (it1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientDestination::HandleDatabaseSearchReplyMessage (const uint8_t * buf, size_t len)
|
void ClientDestination::HandleDatabaseSearchReplyMessage (const uint8_t * buf, size_t len)
|
||||||
|
Loading…
Reference in New Issue
Block a user