process session created after decryption with intro key

This commit is contained in:
orignal 2014-04-07 16:53:28 -04:00
parent 64f195868e
commit be563dcbd1

23
SSU.cpp
View File

@ -61,13 +61,10 @@ namespace ssu
break;
// establishing or testing
case eSessionStateUnknown:
case eSessionStateRequestSent:
// we must use intro key
ProcessIntroKeyMessage (buf, len, senderEndpoint);
break;
case eSessionStateRequestSent:
// session created
ProcessSessionCreated (buf, len);
break;
case eSessionStateCreatedSent:
// session confirmed
ProcessSessionConfirmed (buf, len);
@ -147,7 +144,10 @@ namespace ssu
switch (header->GetPayloadType ())
{
case PAYLOAD_TYPE_SESSION_REQUEST:
ProcessSessionRequest (buf + sizeof (SSUHeader), len - sizeof (SSUHeader), senderEndpoint);
ProcessSessionRequest (buf, len, senderEndpoint);
break;
case PAYLOAD_TYPE_SESSION_CREATED:
ProcessSessionCreated (buf, len);
break;
case PAYLOAD_TYPE_PEER_TEST:
// TODO
@ -162,27 +162,17 @@ namespace ssu
m_State = eSessionStateRequestReceived;
LogPrint ("Session request received");
m_RemoteEndpoint = senderEndpoint;
SendSessionCreated (buf);
SendSessionCreated (buf + sizeof (SSUHeader));
}
void SSUSession::ProcessSessionCreated (uint8_t * buf, size_t len)
{
LogPrint ("Process session created");
if (!m_RemoteRouter)
{
LogPrint ("Unsolicited session created message");
return;
}
// use remote intro key
if (ProcessIntroKeyEncryptedMessage (buf, len))
{
SSUHeader * header = (SSUHeader *)buf;
if (header->GetPayloadType () != PAYLOAD_TYPE_SESSION_CONFIRMED)
{
LogPrint ("Unexpected payload type ", header->GetPayloadType ());
return;
}
m_State = eSessionStateCreatedReceived;
LogPrint ("Session created received");
m_Timer.cancel (); // connect timer
@ -219,7 +209,6 @@ namespace ssu
SendSessionConfirmed (y, ourAddress, relayTag);
}
}
void SSUSession::ProcessSessionConfirmed (uint8_t * buf, size_t len)
{