Browse Source

clean code

Signed-off-by: R4SAS <r4sas@i2pmail.org>
pull/1794/head
R4SAS 2 years ago
parent
commit
96c4463d39
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2
  1. 4
      libi2pd/SSU2.cpp
  2. 8
      libi2pd/SSU2Session.cpp

4
libi2pd/SSU2.cpp

@ -544,7 +544,7 @@ namespace transport
{ {
onEstablished (); onEstablished ();
s->SendPeerTest (); s->SendPeerTest ();
}); });
else else
s->SetOnEstablished ([s]() { s->SendPeerTest (); }); s->SetOnEstablished ([s]() { s->SendPeerTest (); });
} }
@ -822,7 +822,7 @@ namespace transport
if (s.second->IsEstablished () && (s.second->GetRelayTag () && s.second->IsOutgoing ()) && if (s.second->IsEstablished () && (s.second->GetRelayTag () && s.second->IsOutgoing ()) &&
!excluded.count (s.second->GetRemoteIdentity ()->GetIdentHash ()) && !excluded.count (s.second->GetRemoteIdentity ()->GetIdentHash ()) &&
((v4 && (s.second->GetRemoteTransports () & i2p::data::RouterInfo::eSSU2V4)) || ((v4 && (s.second->GetRemoteTransports () & i2p::data::RouterInfo::eSSU2V4)) ||
(!v4 && (s.second->GetRemoteTransports () & i2p::data::RouterInfo::eSSU2V6)))) (!v4 && (s.second->GetRemoteTransports () & i2p::data::RouterInfo::eSSU2V6))))
ret.push_back (s.second); ret.push_back (s.second);
} }
if ((int)ret.size () > maxNumIntroducers) if ((int)ret.size () > maxNumIntroducers)

8
libi2pd/SSU2Session.cpp

@ -1612,7 +1612,7 @@ namespace transport
if (i2p::context.GetStatusV6 () == eRouterStatusTesting) if (i2p::context.GetStatusV6 () == eRouterStatusTesting)
i2p::context.SetErrorV6 (eRouterErrorSymmetricNAT); i2p::context.SetErrorV6 (eRouterErrorSymmetricNAT);
} }
} }
else else
{ {
if (isV4) if (isV4)
@ -1921,7 +1921,7 @@ namespace transport
if (len < 3) return; if (len < 3) return;
uint8_t msg = buf[0]; uint8_t msg = buf[0];
size_t offset = 3; // points to signed data size_t offset = 3; // points to signed data
if (msg == 2 || msg == 4) offset += 32; // hash is presented for msg 2 and 4 only if (msg == 2 || msg == 4) offset += 32; // hash is presented for msg 2 and 4 only
if (len < offset + 5) return; if (len < offset + 5) return;
uint32_t nonce = bufbe32toh (buf + offset + 1); uint32_t nonce = bufbe32toh (buf + offset + 1);
switch (msg) // msg switch (msg) // msg
@ -2369,7 +2369,7 @@ namespace transport
buf[8 + numRanges*2 + 1] = 255; // Acks 255 buf[8 + numRanges*2 + 1] = 255; // Acks 255
numAcks -= 255; numAcks -= 255;
numRanges++; numRanges++;
buf[8 + numRanges*2] = 0; // NACKs 0 buf[8 + numRanges*2] = 0; // NACKs 0
if (numRanges >= maxNumRanges) break; if (numRanges >= maxNumRanges) break;
} }
if (numAcks > 255) numAcks = 255; if (numAcks > 255) numAcks = 255;
@ -2708,7 +2708,7 @@ namespace transport
UpdateReceivePacketNum (packet); UpdateReceivePacketNum (packet);
} }
else else
LogPrint (eLogError, "SSU2: Out of sequence packet ", packet, " is less than last received ", m_ReceivePacketNum); LogPrint (eLogError, "SSU2: Out of sequence packet ", packet, " is less than last received ", m_ReceivePacketNum);
} }
if (m_OutOfSequencePackets.size () > 255*4) if (m_OutOfSequencePackets.size () > 255*4)
{ {

Loading…
Cancel
Save