Compare commits

...

3 Commits

Author SHA1 Message Date
self-related
53e6ae5097 Merge 32a70562c4 into 72ff0b9fbb 2025-01-26 02:31:43 +03:00
orignal
72ff0b9fbb shorter ack request interval 2025-01-25 09:02:18 -05:00
self-related
32a70562c4 Fix UPnP: error 2 2024-08-19 00:07:22 +03:00
3 changed files with 9 additions and 7 deletions

View File

@@ -122,7 +122,7 @@ namespace transport
err = UPNP_GetValidIGD (m_Devlist, &m_upnpUrls, &m_upnpData, m_NetworkAddr, sizeof (m_NetworkAddr)); err = UPNP_GetValidIGD (m_Devlist, &m_upnpUrls, &m_upnpData, m_NetworkAddr, sizeof (m_NetworkAddr));
#endif #endif
m_upnpUrlsInitialized=err!=0; m_upnpUrlsInitialized=err!=0;
if (err == UPNP_IGD_VALID_CONNECTED) if (err == UPNP_IGD_VALID_CONNECTED || err == UPNP_IGD_VALID_NOT_CONNECTED)
{ {
#if (MINIUPNPC_API_VERSION < 18) #if (MINIUPNPC_API_VERSION < 18)
err = UPNP_GetExternalIPAddress (m_upnpUrls.controlURL, m_upnpData.first.servicetype, m_externalIPAddress); err = UPNP_GetExternalIPAddress (m_upnpUrls.controlURL, m_upnpData.first.servicetype, m_externalIPAddress);

View File

@@ -764,6 +764,7 @@ namespace client
void I2CPSession::AddRoutingSession (const i2p::data::IdentHash& signingKey, std::shared_ptr<i2p::garlic::GarlicRoutingSession> remoteSession) void I2CPSession::AddRoutingSession (const i2p::data::IdentHash& signingKey, std::shared_ptr<i2p::garlic::GarlicRoutingSession> remoteSession)
{ {
if (!remoteSession) return; if (!remoteSession) return;
remoteSession->SetAckRequestInterval (I2CP_SESSION_ACK_REQUEST_INTERVAL);
std::lock_guard<std::mutex> l(m_RoutingSessionsMutex); std::lock_guard<std::mutex> l(m_RoutingSessionsMutex);
m_RoutingSessions[signingKey] = remoteSession; m_RoutingSessions[signingKey] = remoteSession;
} }
@@ -1110,12 +1111,12 @@ namespace client
void I2CPServer::Stop () void I2CPServer::Stop ()
{ {
m_Acceptor.cancel (); m_Acceptor.cancel ();
{
auto sessions = m_Sessions; decltype(m_Sessions) sessions;
for (auto& it: sessions) m_Sessions.swap (sessions);
it.second->Stop (); for (auto& it: sessions)
} it.second->Stop ();
m_Sessions.clear ();
StopIOService (); StopIOService ();
} }

View File

@@ -31,6 +31,7 @@ namespace client
const size_t I2CP_MAX_MESSAGE_LENGTH = 65535; const size_t I2CP_MAX_MESSAGE_LENGTH = 65535;
const size_t I2CP_MAX_SEND_QUEUE_SIZE = 1024*1024; // in bytes, 1M const size_t I2CP_MAX_SEND_QUEUE_SIZE = 1024*1024; // in bytes, 1M
const int I2CP_LEASESET_CREATION_TIMEOUT = 10; // in seconds const int I2CP_LEASESET_CREATION_TIMEOUT = 10; // in seconds
const int I2CP_SESSION_ACK_REQUEST_INTERVAL = 12100; // in milliseconds
const size_t I2CP_HEADER_LENGTH_OFFSET = 0; const size_t I2CP_HEADER_LENGTH_OFFSET = 0;
const size_t I2CP_HEADER_TYPE_OFFSET = I2CP_HEADER_LENGTH_OFFSET + 4; const size_t I2CP_HEADER_TYPE_OFFSET = I2CP_HEADER_LENGTH_OFFSET + 4;