don't reset shared receivers from a tunnel that was never started

This commit is contained in:
PobreGato
2026-09-02 03:46:25 +03:00
parent 286e10f8fc
commit 620e51abbc
2 changed files with 11 additions and 0 deletions
+9
View File
@@ -483,6 +483,7 @@ namespace client
void I2PUDPServerTunnel::Start ()
{
m_IsStarted = true;
m_LocalDest->Start ();
auto dgram = m_LocalDest->CreateDatagramDestination (m_Gzip);
@@ -553,6 +554,11 @@ namespace client
void I2PUDPServerTunnel::Stop ()
{
// a config reload builds a second tunnel object and drops it when the same
// one is already there. Its destructor must not reset the receiver of the
// live tunnel: they share the datagram destination
if (!m_IsStarted) return;
m_IsStarted = false;
if (m_StatsTimer) m_StatsTimer->cancel ();
if (m_CleanupTimer) m_CleanupTimer->cancel ();
auto dgram = m_LocalDest->GetDatagramDestination ();
@@ -609,6 +615,7 @@ namespace client
void I2PUDPClientTunnel::Start ()
{
m_IsStarted = true;
UDPConnection::Start ();
// Reset flag in case of tunnel reload
if (m_cancel_resolve) m_cancel_resolve = false;
@@ -643,6 +650,8 @@ namespace client
void I2PUDPClientTunnel::Stop ()
{
if (!m_IsStarted) return; // see the comment in I2PUDPServerTunnel::Stop
m_IsStarted = false;
if (m_KeepAliveTimer) m_KeepAliveTimer->cancel ();
if (m_StatsTimer) m_StatsTimer->cancel ();
+2
View File
@@ -194,6 +194,7 @@ namespace client
UDPSessionPtr m_LastSession;
uint16_t m_inPort;
bool m_Gzip;
bool m_IsStarted = false; // a tunnel that never started shares nothing to tear down
uint32_t m_NumRawNoSession = 0;
size_t m_MaxWindow = I2P_UDP_MIN_MAX_NUM_UNACKED_DATAGRAMS;
std::unique_ptr<boost::asio::steady_timer> m_StatsTimer;
@@ -264,6 +265,7 @@ namespace client
uint16_t RemotePort, m_LastPort;
bool m_cancel_resolve;
bool m_Gzip;
bool m_IsStarted = false; // see the comment in I2PUDPServerTunnel
i2p::datagram::DatagramVersion m_DatagramVersion;
std::shared_ptr<UDPConvo> m_LastSession;
uint32_t m_KeepAliveInterval = 0;