|
|
@ -51,16 +51,19 @@ namespace transport |
|
|
|
|
|
|
|
|
|
|
|
void SSU2Session::Connect () |
|
|
|
void SSU2Session::Connect () |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (m_State == eSSU2SessionStateUnknown) |
|
|
|
if (m_State == eSSU2SessionStateUnknown || m_State == eSSU2SessionStateTokenReceived) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ScheduleConnectTimer (); |
|
|
|
ScheduleConnectTimer (); |
|
|
|
auto token = m_Server.FindOutgoingToken (m_RemoteEndpoint); |
|
|
|
auto token = m_Server.FindOutgoingToken (m_RemoteEndpoint); |
|
|
|
if (token) |
|
|
|
if (token) |
|
|
|
SendSessionRequest (token); |
|
|
|
SendSessionRequest (token); |
|
|
|
else |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_State = eSSU2SessionStateUnknown; |
|
|
|
SendTokenRequest (); |
|
|
|
SendTokenRequest (); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void SSU2Session::ScheduleConnectTimer () |
|
|
|
void SSU2Session::ScheduleConnectTimer () |
|
|
|
{ |
|
|
|
{ |
|
|
@ -959,9 +962,10 @@ namespace transport |
|
|
|
uint64_t oldConnID = GetConnID (); |
|
|
|
uint64_t oldConnID = GetConnID (); |
|
|
|
RAND_bytes ((uint8_t *)&m_DestConnID, 8); |
|
|
|
RAND_bytes ((uint8_t *)&m_DestConnID, 8); |
|
|
|
RAND_bytes ((uint8_t *)&m_SourceConnID, 8); |
|
|
|
RAND_bytes ((uint8_t *)&m_SourceConnID, 8); |
|
|
|
m_Server.UpdateSessionConnID (oldConnID); |
|
|
|
|
|
|
|
// connect
|
|
|
|
// connect
|
|
|
|
m_State = eSSU2SessionStateUnknown; |
|
|
|
m_State = eSSU2SessionStateTokenReceived; |
|
|
|
|
|
|
|
m_Server.AddPendingOutgoingSession (shared_from_this ()); |
|
|
|
|
|
|
|
m_Server.RemoveSession (oldConnID); |
|
|
|
Connect (); |
|
|
|
Connect (); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|