mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 16:34:13 +00:00
token received session state
This commit is contained in:
parent
55f7529167
commit
6b3d7372ae
@ -403,7 +403,7 @@ namespace transport
|
|||||||
i2p::crypto::ChaCha20 (headerX, 48, m_Address->i, nonce, headerX);
|
i2p::crypto::ChaCha20 (headerX, 48, m_Address->i, nonce, headerX);
|
||||||
m_NoiseState->MixHash (payload, payloadSize); // h = SHA256(h || encrypted payload from Session Request) for SessionCreated
|
m_NoiseState->MixHash (payload, payloadSize); // h = SHA256(h || encrypted payload from Session Request) for SessionCreated
|
||||||
// send
|
// send
|
||||||
if (m_Server.AddPendingOutgoingSession (shared_from_this ()))
|
if (m_State == eSSU2SessionStateTokenReceived || m_Server.AddPendingOutgoingSession (shared_from_this ()))
|
||||||
m_Server.Send (header.buf, 16, headerX, 48, payload, payloadSize, m_RemoteEndpoint);
|
m_Server.Send (header.buf, 16, headerX, 48, payload, payloadSize, m_RemoteEndpoint);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -545,7 +545,6 @@ namespace transport
|
|||||||
HandlePayload (decryptedPayload.data (), decryptedPayload.size ());
|
HandlePayload (decryptedPayload.data (), decryptedPayload.size ());
|
||||||
|
|
||||||
m_Server.AddSession (shared_from_this ());
|
m_Server.AddSession (shared_from_this ());
|
||||||
m_Server.RemovePendingOutgoingSession (m_RemoteEndpoint);
|
|
||||||
SendSessionConfirmed (headerX + 16);
|
SendSessionConfirmed (headerX + 16);
|
||||||
KDFDataPhase (m_KeyDataSend, m_KeyDataReceive);
|
KDFDataPhase (m_KeyDataSend, m_KeyDataReceive);
|
||||||
Established ();
|
Established ();
|
||||||
@ -842,8 +841,8 @@ namespace transport
|
|||||||
}
|
}
|
||||||
HandlePayload (payload, len - 48);
|
HandlePayload (payload, len - 48);
|
||||||
|
|
||||||
|
m_State = eSSU2SessionStateTokenReceived;
|
||||||
InitNoiseXKState1 (*m_NoiseState, m_Address->s); // reset Noise TODO: check state
|
InitNoiseXKState1 (*m_NoiseState, m_Address->s); // reset Noise TODO: check state
|
||||||
m_Server.RemovePendingOutgoingSession (m_RemoteEndpoint);
|
|
||||||
SendSessionRequest (headerX[1]);
|
SendSessionRequest (headerX[1]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,7 @@ namespace transport
|
|||||||
enum SSU2SessionState
|
enum SSU2SessionState
|
||||||
{
|
{
|
||||||
eSSU2SessionStateUnknown,
|
eSSU2SessionStateUnknown,
|
||||||
|
eSSU2SessionStateTokenReceived,
|
||||||
eSSU2SessionStateEstablished,
|
eSSU2SessionStateEstablished,
|
||||||
eSSU2SessionStateTerminated,
|
eSSU2SessionStateTerminated,
|
||||||
eSSU2SessionStateFailed,
|
eSSU2SessionStateFailed,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user