Browse Source

fixed race condition

pull/147/head
orignal 10 years ago
parent
commit
a85cc6aa77
  1. 9
      NTCPSession.cpp
  2. 1
      NTCPSession.h
  3. 3
      SSU.h
  4. 3
      SSUSession.cpp

9
NTCPSession.cpp

@ -627,6 +627,11 @@ namespace transport @@ -627,6 +627,11 @@ namespace transport
}
void NTCPSession::SendI2NPMessage (I2NPMessage * msg)
{
m_Server.GetService ().post (std::bind (&NTCPSession::PostI2NPMessage, shared_from_this (), msg));
}
void NTCPSession::PostI2NPMessage (I2NPMessage * msg)
{
if (msg)
{
@ -634,9 +639,9 @@ namespace transport @@ -634,9 +639,9 @@ namespace transport
Send (msg);
else
m_DelayedMessages.push_back (msg);
}
}
}
void NTCPSession::ScheduleTermination ()
{
m_TerminationTimer.cancel ();

1
NTCPSession.h

@ -67,6 +67,7 @@ namespace transport @@ -67,6 +67,7 @@ namespace transport
protected:
void PostI2NPMessage (I2NPMessage * msg);
void Connected ();
void SendTimeSyncMessage ();
void SetIsEstablished (bool isEstablished) { m_IsEstablished = isEstablished; }

3
SSU.h

@ -38,7 +38,8 @@ namespace transport @@ -38,7 +38,8 @@ namespace transport
void DeleteSession (std::shared_ptr<SSUSession> session);
void DeleteAllSessions ();
boost::asio::io_service& GetService () { return m_Socket.get_io_service(); };
boost::asio::io_service& GetService () { return m_Service; };
boost::asio::io_service& GetServiceV6 () { return m_ServiceV6; };
const boost::asio::ip::udp::endpoint& GetEndpoint () const { return m_Endpoint; };
void Send (const uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& to);
void AddRelay (uint32_t tag, const boost::asio::ip::udp::endpoint& relay);

3
SSUSession.cpp

@ -828,7 +828,8 @@ namespace transport @@ -828,7 +828,8 @@ namespace transport
void SSUSession::SendI2NPMessage (I2NPMessage * msg)
{
m_Server.GetService ().post (std::bind (&SSUSession::PostI2NPMessage, shared_from_this (), msg));
boost::asio::io_service& service = IsV6 () ? m_Server.GetServiceV6 () : m_Server.GetService ();
service.post (std::bind (&SSUSession::PostI2NPMessage, shared_from_this (), msg));
}
void SSUSession::PostI2NPMessage (I2NPMessage * msg)

Loading…
Cancel
Save