From 88e6a76a1b0894599be9097582007191f503598e Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 31 Mar 2014 07:51:18 -0400 Subject: [PATCH] don't send session request twice --- SSU.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/SSU.cpp b/SSU.cpp index 4d80afd1c09..b0d351ff75a 100644 --- a/SSU.cpp +++ b/SSU.cpp @@ -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)