mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
resend SessionConfirmed immediately if another SessionCreated received
This commit is contained in:
parent
a3e19931f0
commit
000e0358a7
|
@ -336,13 +336,8 @@ namespace transport
|
||||||
if (m_SentHandshakePacket && ts >= m_SentHandshakePacket->nextResendTime)
|
if (m_SentHandshakePacket && ts >= m_SentHandshakePacket->nextResendTime)
|
||||||
{
|
{
|
||||||
LogPrint (eLogDebug, "SSU2: Resending ", (int)m_State);
|
LogPrint (eLogDebug, "SSU2: Resending ", (int)m_State);
|
||||||
m_Server.Send (m_SentHandshakePacket->header.buf, 16, m_SentHandshakePacket->headerX, 48,
|
ResendHandshakePacket ();
|
||||||
m_SentHandshakePacket->payload, m_SentHandshakePacket->payloadSize, m_RemoteEndpoint);
|
|
||||||
m_SentHandshakePacket->nextResendTime = ts + SSU2_HANDSHAKE_RESEND_INTERVAL;
|
m_SentHandshakePacket->nextResendTime = ts + SSU2_HANDSHAKE_RESEND_INTERVAL;
|
||||||
if (m_SessionConfirmedFragment && m_State == eSSU2SessionStateSessionConfirmedSent)
|
|
||||||
// resend second fragment of SessionConfirmed
|
|
||||||
m_Server.Send (m_SessionConfirmedFragment->header.buf, 16,
|
|
||||||
m_SessionConfirmedFragment->payload, m_SessionConfirmedFragment->payloadSize, m_RemoteEndpoint);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// resend data packets
|
// resend data packets
|
||||||
|
@ -382,6 +377,19 @@ namespace transport
|
||||||
SendQueue ();
|
SendQueue ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SSU2Session::ResendHandshakePacket ()
|
||||||
|
{
|
||||||
|
if (m_SentHandshakePacket)
|
||||||
|
{
|
||||||
|
m_Server.Send (m_SentHandshakePacket->header.buf, 16, m_SentHandshakePacket->headerX, 48,
|
||||||
|
m_SentHandshakePacket->payload, m_SentHandshakePacket->payloadSize, m_RemoteEndpoint);
|
||||||
|
if (m_SessionConfirmedFragment && m_State == eSSU2SessionStateSessionConfirmedSent)
|
||||||
|
// resend second fragment of SessionConfirmed
|
||||||
|
m_Server.Send (m_SessionConfirmedFragment->header.buf, 16,
|
||||||
|
m_SessionConfirmedFragment->payload, m_SessionConfirmedFragment->payloadSize, m_RemoteEndpoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool SSU2Session::ProcessFirstIncomingMessage (uint64_t connID, uint8_t * buf, size_t len)
|
bool SSU2Session::ProcessFirstIncomingMessage (uint64_t connID, uint8_t * buf, size_t len)
|
||||||
{
|
{
|
||||||
// we are Bob
|
// we are Bob
|
||||||
|
@ -1190,7 +1198,10 @@ namespace transport
|
||||||
if (header.h.type != eSSU2Data)
|
if (header.h.type != eSSU2Data)
|
||||||
{
|
{
|
||||||
LogPrint (eLogWarning, "SSU2: Unexpected message type ", (int)header.h.type, " instead ", (int)eSSU2Data);
|
LogPrint (eLogWarning, "SSU2: Unexpected message type ", (int)header.h.type, " instead ", (int)eSSU2Data);
|
||||||
|
if (IsEstablished ())
|
||||||
SendQuickAck (); // in case it was SessionConfirmed
|
SendQuickAck (); // in case it was SessionConfirmed
|
||||||
|
else
|
||||||
|
ResendHandshakePacket (); // assume we receive
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint8_t payload[SSU2_MAX_PACKET_SIZE];
|
uint8_t payload[SSU2_MAX_PACKET_SIZE];
|
||||||
|
|
|
@ -252,6 +252,7 @@ namespace transport
|
||||||
void PostI2NPMessages (std::vector<std::shared_ptr<I2NPMessage> > msgs);
|
void PostI2NPMessages (std::vector<std::shared_ptr<I2NPMessage> > msgs);
|
||||||
bool SendQueue ();
|
bool SendQueue ();
|
||||||
void SendFragmentedMessage (std::shared_ptr<I2NPMessage> msg);
|
void SendFragmentedMessage (std::shared_ptr<I2NPMessage> msg);
|
||||||
|
void ResendHandshakePacket ();
|
||||||
|
|
||||||
void ProcessSessionRequest (Header& header, uint8_t * buf, size_t len);
|
void ProcessSessionRequest (Header& header, uint8_t * buf, size_t len);
|
||||||
void ProcessTokenRequest (Header& header, uint8_t * buf, size_t len);
|
void ProcessTokenRequest (Header& header, uint8_t * buf, size_t len);
|
||||||
|
|
Loading…
Reference in a new issue