From ccbc4353d6a9b2bda890cf89fe7d8bc87a5713b6 Mon Sep 17 00:00:00 2001 From: orignal Date: Sat, 30 Aug 2014 16:30:53 -0400 Subject: [PATCH] fixed race condition --- SSU.cpp | 9 +++++++-- SSU.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/SSU.cpp b/SSU.cpp index bc49030a..1a3d938f 100644 --- a/SSU.cpp +++ b/SSU.cpp @@ -690,6 +690,11 @@ namespace ssu } void SSUSession::SendI2NPMessage (I2NPMessage * msg) + { + m_Server.GetService ().post (boost::bind (&SSUSession::PostI2NPMessage, this, msg)); + } + + void SSUSession::PostI2NPMessage (I2NPMessage * msg) { if (msg) { @@ -698,8 +703,8 @@ namespace ssu else m_DelayedMessages.push_back (msg); } - } - + } + void SSUSession::ProcessData (uint8_t * buf, size_t len) { m_Data.ProcessMessage (buf, len); diff --git a/SSU.h b/SSU.h index d5d4ebc3..5a72b4d0 100644 --- a/SSU.h +++ b/SSU.h @@ -81,6 +81,7 @@ namespace ssu void CreateAESandMacKey (const uint8_t * pubKey); + void PostI2NPMessage (I2NPMessage * msg); void ProcessMessage (uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& senderEndpoint); // call for established session void ProcessSessionRequest (uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& senderEndpoint); void SendSessionRequest ();