Skip to content

Commit

Permalink
Merge pull request #25 from orignal/master
Browse files Browse the repository at this point in the history
don't send session request twice
  • Loading branch information
chertov committed Mar 31, 2014
2 parents 6e73ccf + 88e6a76 commit 57dd362
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions SSU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,15 +492,17 @@ namespace ssu

void SSUSession::Connect ()
{
if (m_Server)
if (m_State == eSessionStateUnknown)
{
if (!m_ConnectTimer)
if (m_Server)
{
m_ConnectTimer = new boost::asio::deadline_timer (m_Server->GetService ());
m_ConnectTimer->expires_from_now (boost::posix_time::seconds(SSU_CONNECT_TIMEOUT));
m_ConnectTimer->async_wait (boost::bind (&SSUSession::HandleConnectTimer,
this, boost::asio::placeholders::error));
}
SendSessionRequest ();
m_ConnectTimer->expires_from_now (boost::posix_time::seconds(SSU_CONNECT_TIMEOUT));
m_ConnectTimer->async_wait (boost::bind (&SSUSession::HandleConnectTimer,
this, boost::asio::placeholders::error));
}
SendSessionRequest ();
}
}

void SSUSession::HandleConnectTimer (const boost::system::error_code& ecode)
Expand Down

0 comments on commit 57dd362

Please sign in to comment.