create DH keys for SSU session directly

This commit is contained in:
orignal 2020-10-13 21:12:52 -04:00
parent 614921276e
commit acc5592f59
5 changed files with 11 additions and 23 deletions

View file

@ -224,7 +224,11 @@ namespace transport
return;
}
if (!m_DHKeysPair)
m_DHKeysPair = transports.GetNextDHKeysPair ();
{
auto pair = std::make_shared<i2p::crypto::DHKeys> ();
pair->GenerateKeys ();
m_DHKeysPair = pair;
}
CreateAESandMacKey (buf + headerSize);
SendSessionCreated (buf + headerSize, sendRelayTag);
}
@ -826,9 +830,9 @@ namespace transport
{
if (m_State == eSessionStateUnknown)
{
// set connect timer
ScheduleConnectTimer ();
m_DHKeysPair = transports.GetNextDHKeysPair ();
ScheduleConnectTimer (); // set connect timer
m_DHKeysPair = std::make_shared<i2p::crypto::DHKeys> ();
m_DHKeysPair->GenerateKeys ();
SendSessionRequest ();
}
}