Browse Source

read Identity from SessionConfirmed message

pull/99/head
orignal 10 years ago
parent
commit
cb46d63058
  1. 16
      SSU.cpp
  2. 1
      SSU.h

16
SSU.cpp

@ -226,7 +226,21 @@ namespace ssu @@ -226,7 +226,21 @@ namespace ssu
void SSUSession::ProcessSessionConfirmed (uint8_t * buf, size_t len)
{
LogPrint ("Session confirmed received");
LogPrint ("Session confirmed received");
uint8_t * payload = buf + sizeof (SSUHeader);
payload++; // identity fragment info
uint16_t identitySize = be16toh (*(uint16_t *)payload);
payload += 2; // size of identity fragment
if (identitySize == i2p::data::DEFAULT_IDENTITY_SIZE)
{
i2p::data::Identity ident;
ident.FromBuffer (payload, identitySize);
m_RemoteIdent = ident.Hash ();
}
else
LogPrint ("SSU unexpected identity size ", identitySize);
payload += identitySize; // identity
// TODO: verify signature
SendI2NPMessage (CreateDeliveryStatusMsg (0));
Established ();
}

1
SSU.h

@ -129,6 +129,7 @@ namespace ssu @@ -129,6 +129,7 @@ namespace ssu
SSUServer& m_Server;
boost::asio::ip::udp::endpoint m_RemoteEndpoint;
const i2p::data::RouterInfo * m_RemoteRouter;
i2p::data::IdentHash m_RemoteIdent; // if m_RemoteRouter is null
boost::asio::deadline_timer m_Timer;
i2p::data::DHKeysPair * m_DHKeysPair; // X - for client and Y - for server
bool m_PeerTest;

Loading…
Cancel
Save