diff --git a/libi2pd_client/ClientContext.cpp b/libi2pd_client/ClientContext.cpp index 2a60cd29..cbcbdc49 100644 --- a/libi2pd_client/ClientContext.cpp +++ b/libi2pd_client/ClientContext.cpp @@ -218,6 +218,10 @@ namespace client } { + // let tunnels finish + LogPrint(eLogInfo, "Clients: Waiting for ", STOP_DESTINATIONS_TIMEOUT, "seconds"); + std::this_thread::sleep_for (std::chrono::seconds (STOP_DESTINATIONS_TIMEOUT)); + // stop destinations LogPrint(eLogInfo, "Clients: Stopping Destinations"); std::lock_guard lock(m_DestinationsMutex); for (auto& it: m_Destinations) diff --git a/libi2pd_client/ClientContext.h b/libi2pd_client/ClientContext.h index f9e37925..14b6538d 100644 --- a/libi2pd_client/ClientContext.h +++ b/libi2pd_client/ClientContext.h @@ -81,6 +81,8 @@ namespace client const char TORRENTS_TUNNEL_RPC_PATH[] = "rpcpath"; const char TORRENTS_TUNNEL_RPC_ADDRESS[] = "rpcaddress"; + constexpr int STOP_DESTINATIONS_TIMEOUT = 3; // in seconds + class ClientContext { public: