Browse Source

fixed potential race condition

pull/1231/head
orignal 6 years ago
parent
commit
062d8d0f4f
  1. 3
      libi2pd_client/AddressBook.cpp

3
libi2pd_client/AddressBook.cpp

@ -755,7 +755,8 @@ namespace client
}, },
SUBSCRIPTION_REQUEST_TIMEOUT); SUBSCRIPTION_REQUEST_TIMEOUT);
std::unique_lock<std::mutex> l(newDataReceivedMutex); std::unique_lock<std::mutex> l(newDataReceivedMutex);
if (newDataReceived.wait_for (l, std::chrono::seconds (SUBSCRIPTION_REQUEST_TIMEOUT)) == std::cv_status::timeout) // wait 1 more second
if (newDataReceived.wait_for (l, std::chrono::seconds (SUBSCRIPTION_REQUEST_TIMEOUT + 1)) == std::cv_status::timeout)
{ {
LogPrint (eLogError, "Addressbook: subscriptions request timeout expired"); LogPrint (eLogError, "Addressbook: subscriptions request timeout expired");
numAttempts++; numAttempts++;

Loading…
Cancel
Save