Browse Source

process session created after decryption with intro key

pull/60/head
orignal 11 years ago
parent
commit
be563dcbd1
  1. 23
      SSU.cpp

23
SSU.cpp

@ -61,13 +61,10 @@ namespace ssu @@ -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 @@ -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 @@ -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 @@ -219,7 +209,6 @@ namespace ssu
SendSessionConfirmed (y, ourAddress, relayTag);
}
}
void SSUSession::ProcessSessionConfirmed (uint8_t * buf, size_t len)
{

Loading…
Cancel
Save