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
if (packet->IsSYN () && !packet->GetSeqn ()) // new incoming stream if (packet->IsSYN () && !packet->GetSeqn ()) // new incoming stream
{ {
auto incomingStream = CreateNewIncomingStream (); 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(); auto ident = incomingStream->GetRemoteIdentity();
if(ident) if(ident)
{ {
@ -874,6 +861,7 @@ namespace stream
{ {
// drop // drop
LogPrint(eLogWarning, "Streaming: Too many inbound streams from ", ih.ToBase32()); LogPrint(eLogWarning, "Streaming: Too many inbound streams from ", ih.ToBase32());
incomingStream->Close();
DeleteStream(incomingStream); DeleteStream(incomingStream);
incomingStream = nullptr; incomingStream = nullptr;
delete packet; delete packet;
@ -881,6 +869,20 @@ namespace stream
} }
} else } else
LogPrint(eLogWarning, "Streaming: Inbound stream has no identity"); 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 // accept
if (m_Acceptor != nullptr) if (m_Acceptor != nullptr)
m_Acceptor (incomingStream); m_Acceptor (incomingStream);

Loading…
Cancel
Save