mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-24 01:46:36 +02:00
schdule connect timer
This commit is contained in:
parent
617e7bc81d
commit
10d9a4582f
2 changed files with 12 additions and 4 deletions
15
SSU.cpp
15
SSU.cpp
|
@ -23,7 +23,8 @@ namespace ssu
|
||||||
m_NumSentBytes (0), m_NumReceivedBytes (0)
|
m_NumSentBytes (0), m_NumReceivedBytes (0)
|
||||||
{
|
{
|
||||||
m_DHKeysPair = i2p::transports.GetNextDHKeysPair ();
|
m_DHKeysPair = i2p::transports.GetNextDHKeysPair ();
|
||||||
ScheduleTermination ();
|
if (!router) // incoming session
|
||||||
|
ScheduleConnectTimer ();
|
||||||
}
|
}
|
||||||
|
|
||||||
SSUSession::~SSUSession ()
|
SSUSession::~SSUSession ()
|
||||||
|
@ -584,13 +585,19 @@ namespace ssu
|
||||||
if (m_State == eSessionStateUnknown)
|
if (m_State == eSessionStateUnknown)
|
||||||
{
|
{
|
||||||
// set connect timer
|
// set connect timer
|
||||||
m_Timer.expires_from_now (boost::posix_time::seconds(SSU_CONNECT_TIMEOUT));
|
ScheduleConnectTimer ();
|
||||||
m_Timer.async_wait (boost::bind (&SSUSession::HandleConnectTimer,
|
|
||||||
this, boost::asio::placeholders::error));
|
|
||||||
SendSessionRequest ();
|
SendSessionRequest ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SSUSession::ScheduleConnectTimer ()
|
||||||
|
{
|
||||||
|
m_Timer.cancel ();
|
||||||
|
m_Timer.expires_from_now (boost::posix_time::seconds(SSU_CONNECT_TIMEOUT));
|
||||||
|
m_Timer.async_wait (boost::bind (&SSUSession::HandleConnectTimer,
|
||||||
|
this, boost::asio::placeholders::error));
|
||||||
|
}
|
||||||
|
|
||||||
void SSUSession::HandleConnectTimer (const boost::system::error_code& ecode)
|
void SSUSession::HandleConnectTimer (const boost::system::error_code& ecode)
|
||||||
{
|
{
|
||||||
if (!ecode)
|
if (!ecode)
|
||||||
|
|
1
SSU.h
1
SSU.h
|
@ -97,6 +97,7 @@ namespace ssu
|
||||||
void ProcessRelayIntro (uint8_t * buf, size_t len);
|
void ProcessRelayIntro (uint8_t * buf, size_t len);
|
||||||
void Established ();
|
void Established ();
|
||||||
void Failed ();
|
void Failed ();
|
||||||
|
void ScheduleConnectTimer ();
|
||||||
void HandleConnectTimer (const boost::system::error_code& ecode);
|
void HandleConnectTimer (const boost::system::error_code& ecode);
|
||||||
void ProcessPeerTest (uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& senderEndpoint);
|
void ProcessPeerTest (uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& senderEndpoint);
|
||||||
void SendPeerTest (uint32_t nonce, uint32_t address, uint16_t port, uint8_t * introKey, bool toAddress = true);
|
void SendPeerTest (uint32_t nonce, uint32_t address, uint16_t port, uint8_t * introKey, bool toAddress = true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue