mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
fixed race condition
This commit is contained in:
parent
6683a9cf76
commit
a85cc6aa77
@ -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
|
||||
Send (msg);
|
||||
else
|
||||
m_DelayedMessages.push_back (msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void NTCPSession::ScheduleTermination ()
|
||||
{
|
||||
m_TerminationTimer.cancel ();
|
||||
|
@ -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
3
SSU.h
@ -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);
|
||||
|
@ -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…
Reference in New Issue
Block a user