From ecd3a49d48378ac5156caafd43f98e421afc8f9a Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 10 Jun 2016 11:47:22 -0400 Subject: [PATCH] handle DestroySession properly --- I2CP.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/I2CP.cpp b/I2CP.cpp index 20f9dcee..d3ad2350 100644 --- a/I2CP.cpp +++ b/I2CP.cpp @@ -117,9 +117,8 @@ namespace client I2CPSession::I2CPSession (I2CPServer& owner, std::shared_ptr socket): m_Owner (owner), m_Socket (socket), m_NextMessage (nullptr), m_NextMessageLen (0), m_NextMessageOffset (0), - m_MessageID (0), m_IsSendAccepted (true) + m_SessionID (0), m_MessageID (0), m_IsSendAccepted (true) { - RAND_bytes ((uint8_t *)&m_SessionID, 2); } I2CPSession::~I2CPSession () @@ -315,6 +314,7 @@ namespace client void I2CPSession::CreateSessionMessageHandler (const uint8_t * buf, size_t len) { + RAND_bytes ((uint8_t *)&m_SessionID, 2); auto identity = std::make_shared(); size_t offset = identity->FromBuffer (buf, len); if (!offset) @@ -365,7 +365,11 @@ namespace client { SendSessionStatusMessage (0); // destroy LogPrint (eLogDebug, "I2CP: session ", m_SessionID, " destroyed"); - Terminate (); + if (m_Destination) + { + m_Destination->Stop (); + m_Destination = 0; + } } void I2CPSession::ReconfigureSessionMessageHandler (const uint8_t * buf, size_t len)