mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
check if address type matches peer's address type for peer test msg 1
This commit is contained in:
parent
ae73e8a305
commit
8a6fe0f321
@ -148,9 +148,12 @@ namespace transport
|
|||||||
// peer test block
|
// peer test block
|
||||||
uint8_t payload[SSU2_MAX_PACKET_SIZE];
|
uint8_t payload[SSU2_MAX_PACKET_SIZE];
|
||||||
size_t payloadSize = CreatePeerTestBlock (payload, m_MaxPayloadSize, nonce);
|
size_t payloadSize = CreatePeerTestBlock (payload, m_MaxPayloadSize, nonce);
|
||||||
|
if (payloadSize > 0)
|
||||||
|
{
|
||||||
payloadSize += CreatePaddingBlock (payload + payloadSize, m_MaxPayloadSize - payloadSize);
|
payloadSize += CreatePaddingBlock (payload + payloadSize, m_MaxPayloadSize - payloadSize);
|
||||||
SendData (payload, payloadSize);
|
SendData (payload, payloadSize);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SSU2Session::SendKeepAlive ()
|
void SSU2Session::SendKeepAlive ()
|
||||||
{
|
{
|
||||||
@ -2314,7 +2317,8 @@ namespace transport
|
|||||||
size_t SSU2Session::CreatePeerTestBlock (uint8_t * buf, size_t len, uint32_t nonce)
|
size_t SSU2Session::CreatePeerTestBlock (uint8_t * buf, size_t len, uint32_t nonce)
|
||||||
{
|
{
|
||||||
auto localAddress = FindLocalAddress ();
|
auto localAddress = FindLocalAddress ();
|
||||||
if (!localAddress || !localAddress->port || localAddress->host.is_unspecified ())
|
if (!localAddress || !localAddress->port || localAddress->host.is_unspecified () ||
|
||||||
|
localAddress->host.is_v4 () != m_RemoteEndpoint.address ().is_v4 ())
|
||||||
{
|
{
|
||||||
LogPrint (eLogWarning, "SSU2: Can't find local address for peer test");
|
LogPrint (eLogWarning, "SSU2: Can't find local address for peer test");
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user