mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
streaming limiting tweaks
This commit is contained in:
parent
df8d73ae43
commit
34da9a9655
@ -853,6 +853,23 @@ namespace stream
|
||||
if (packet->IsSYN () && !packet->GetSeqn ()) // new incoming stream
|
||||
{
|
||||
auto incomingStream = CreateNewIncomingStream ();
|
||||
auto ident = incomingStream->GetRemoteIdentity();
|
||||
if(ident)
|
||||
{
|
||||
auto ih = ident->GetIdentHash();
|
||||
if(DropNewStream(ih))
|
||||
{
|
||||
// drop
|
||||
LogPrint(eLogWarning, "Streaming: Too many inbound streams from ", ih.ToBase32());
|
||||
incomingStream->Close();
|
||||
DeleteStream(incomingStream);
|
||||
incomingStream = nullptr;
|
||||
delete packet;
|
||||
return;
|
||||
}
|
||||
} else
|
||||
LogPrint(eLogWarning, "Streaming: Inbound stream has no identity");
|
||||
|
||||
uint32_t receiveStreamID = packet->GetReceiveStreamID ();
|
||||
incomingStream->HandleNextPacket (packet); // SYN
|
||||
// handle saved packets if any
|
||||
@ -866,21 +883,6 @@ namespace stream
|
||||
m_SavedPackets.erase (it);
|
||||
}
|
||||
}
|
||||
auto ident = incomingStream->GetRemoteIdentity();
|
||||
if(ident)
|
||||
{
|
||||
auto ih = ident->GetIdentHash();
|
||||
if(DropNewStream(ih))
|
||||
{
|
||||
// drop
|
||||
LogPrint(eLogWarning, "Streaming: Too many inbound streams from ", ih.ToBase32());
|
||||
DeleteStream(incomingStream);
|
||||
incomingStream = nullptr;
|
||||
delete packet;
|
||||
return;
|
||||
}
|
||||
} else
|
||||
LogPrint(eLogWarning, "Streaming: Inbound stream has no identity");
|
||||
// accept
|
||||
if (m_Acceptor != nullptr)
|
||||
m_Acceptor (incomingStream);
|
||||
|
Loading…
x
Reference in New Issue
Block a user