mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
read Identity from SessionConfirmed message
This commit is contained in:
parent
ddc18a9b28
commit
cb46d63058
16
SSU.cpp
16
SSU.cpp
@ -226,7 +226,21 @@ namespace ssu
|
|||||||
|
|
||||||
void SSUSession::ProcessSessionConfirmed (uint8_t * buf, size_t len)
|
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));
|
SendI2NPMessage (CreateDeliveryStatusMsg (0));
|
||||||
Established ();
|
Established ();
|
||||||
}
|
}
|
||||||
|
1
SSU.h
1
SSU.h
@ -129,6 +129,7 @@ namespace ssu
|
|||||||
SSUServer& m_Server;
|
SSUServer& m_Server;
|
||||||
boost::asio::ip::udp::endpoint m_RemoteEndpoint;
|
boost::asio::ip::udp::endpoint m_RemoteEndpoint;
|
||||||
const i2p::data::RouterInfo * m_RemoteRouter;
|
const i2p::data::RouterInfo * m_RemoteRouter;
|
||||||
|
i2p::data::IdentHash m_RemoteIdent; // if m_RemoteRouter is null
|
||||||
boost::asio::deadline_timer m_Timer;
|
boost::asio::deadline_timer m_Timer;
|
||||||
i2p::data::DHKeysPair * m_DHKeysPair; // X - for client and Y - for server
|
i2p::data::DHKeysPair * m_DHKeysPair; // X - for client and Y - for server
|
||||||
bool m_PeerTest;
|
bool m_PeerTest;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user