mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
fixed race condition
This commit is contained in:
parent
6683a9cf76
commit
a85cc6aa77
@ -627,6 +627,11 @@ namespace transport
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NTCPSession::SendI2NPMessage (I2NPMessage * msg)
|
void NTCPSession::SendI2NPMessage (I2NPMessage * msg)
|
||||||
|
{
|
||||||
|
m_Server.GetService ().post (std::bind (&NTCPSession::PostI2NPMessage, shared_from_this (), msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
void NTCPSession::PostI2NPMessage (I2NPMessage * msg)
|
||||||
{
|
{
|
||||||
if (msg)
|
if (msg)
|
||||||
{
|
{
|
||||||
@ -634,9 +639,9 @@ namespace transport
|
|||||||
Send (msg);
|
Send (msg);
|
||||||
else
|
else
|
||||||
m_DelayedMessages.push_back (msg);
|
m_DelayedMessages.push_back (msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NTCPSession::ScheduleTermination ()
|
void NTCPSession::ScheduleTermination ()
|
||||||
{
|
{
|
||||||
m_TerminationTimer.cancel ();
|
m_TerminationTimer.cancel ();
|
||||||
|
@ -67,6 +67,7 @@ namespace transport
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
void PostI2NPMessage (I2NPMessage * msg);
|
||||||
void Connected ();
|
void Connected ();
|
||||||
void SendTimeSyncMessage ();
|
void SendTimeSyncMessage ();
|
||||||
void SetIsEstablished (bool isEstablished) { m_IsEstablished = isEstablished; }
|
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 DeleteSession (std::shared_ptr<SSUSession> session);
|
||||||
void DeleteAllSessions ();
|
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; };
|
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 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);
|
void AddRelay (uint32_t tag, const boost::asio::ip::udp::endpoint& relay);
|
||||||
|
@ -828,7 +828,8 @@ namespace transport
|
|||||||
|
|
||||||
void SSUSession::SendI2NPMessage (I2NPMessage * msg)
|
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)
|
void SSUSession::PostI2NPMessage (I2NPMessage * msg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user