Browse Source

report about termination after actual processing

pull/120/head
orignal 10 years ago
parent
commit
446e5fd665
  1. 6
      AddressBook.cpp
  2. 1
      AddressBook.h
  3. 17
      Destination.cpp

6
AddressBook.cpp

@ -443,7 +443,8 @@ 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);
} }
@ -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))

1
AddressBook.h

@ -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
{ {

17
Destination.cpp

@ -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…
Cancel
Save