Browse Source

streaming limiting tweaks

pull/628/head
Jeff Becker 8 years ago
parent
commit
34da9a9655
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B
  1. 28
      Streaming.cpp

28
Streaming.cpp

@ -853,19 +853,6 @@ namespace stream @@ -853,19 +853,6 @@ namespace stream
if (packet->IsSYN () && !packet->GetSeqn ()) // new incoming stream
{
auto incomingStream = CreateNewIncomingStream ();
uint32_t receiveStreamID = packet->GetReceiveStreamID ();
incomingStream->HandleNextPacket (packet); // SYN
// handle saved packets if any
{
auto it = m_SavedPackets.find (receiveStreamID);
if (it != m_SavedPackets.end ())
{
LogPrint (eLogDebug, "Streaming: Processing ", it->second.size (), " saved packets for rSID=", receiveStreamID);
for (auto it1: it->second)
incomingStream->HandleNextPacket (it1);
m_SavedPackets.erase (it);
}
}
auto ident = incomingStream->GetRemoteIdentity();
if(ident)
{
@ -874,6 +861,7 @@ namespace stream @@ -874,6 +861,7 @@ namespace stream
{
// drop
LogPrint(eLogWarning, "Streaming: Too many inbound streams from ", ih.ToBase32());
incomingStream->Close();
DeleteStream(incomingStream);
incomingStream = nullptr;
delete packet;
@ -881,6 +869,20 @@ namespace stream @@ -881,6 +869,20 @@ namespace stream
}
} else
LogPrint(eLogWarning, "Streaming: Inbound stream has no identity");
uint32_t receiveStreamID = packet->GetReceiveStreamID ();
incomingStream->HandleNextPacket (packet); // SYN
// handle saved packets if any
{
auto it = m_SavedPackets.find (receiveStreamID);
if (it != m_SavedPackets.end ())
{
LogPrint (eLogDebug, "Streaming: Processing ", it->second.size (), " saved packets for rSID=", receiveStreamID);
for (auto it1: it->second)
incomingStream->HandleNextPacket (it1);
m_SavedPackets.erase (it);
}
}
// accept
if (m_Acceptor != nullptr)
m_Acceptor (incomingStream);

Loading…
Cancel
Save