Browse Source

temirminate incoming right a way if no remote LeaseSet

pull/2094/merge
orignal 2 weeks ago
parent
commit
dbef3fe9d2
  1. 8
      libi2pd/Streaming.cpp
  2. 1
      libi2pd/Streaming.h

8
libi2pd/Streaming.cpp

@ -1713,7 +1713,12 @@ namespace stream
} }
auto incomingStream = CreateNewIncomingStream (receiveStreamID); auto incomingStream = CreateNewIncomingStream (receiveStreamID);
incomingStream->HandleNextPacket (packet); // SYN incomingStream->HandleNextPacket (packet); // SYN
auto ident = incomingStream->GetRemoteIdentity(); if (!incomingStream->GetRemoteLeaseSet ())
{
LogPrint (eLogWarning, "Streaming: No remote LeaseSet for incoming stream. Terminated");
incomingStream->Terminate (); // can't send FIN anyway
return;
}
// handle saved packets if any // handle saved packets if any
{ {
@ -1815,6 +1820,7 @@ namespace stream
{ {
std::unique_lock<std::mutex> l(m_StreamsMutex); std::unique_lock<std::mutex> l(m_StreamsMutex);
m_Streams.erase (stream->GetRecvStreamID ()); m_Streams.erase (stream->GetRecvStreamID ());
if (stream->IsIncoming ())
m_IncomingStreams.erase (stream->GetSendStreamID ()); m_IncomingStreams.erase (stream->GetSendStreamID ());
if (m_LastStream == stream) m_LastStream = nullptr; if (m_LastStream == stream) m_LastStream = nullptr;
} }

1
libi2pd/Streaming.h

@ -187,6 +187,7 @@ namespace stream
std::shared_ptr<const i2p::data::IdentityEx> GetRemoteIdentity () const { return m_RemoteIdentity; }; std::shared_ptr<const i2p::data::IdentityEx> GetRemoteIdentity () const { return m_RemoteIdentity; };
bool IsOpen () const { return m_Status == eStreamStatusOpen; }; bool IsOpen () const { return m_Status == eStreamStatusOpen; };
bool IsEstablished () const { return m_SendStreamID; }; bool IsEstablished () const { return m_SendStreamID; };
bool IsIncoming () const { return m_IsIncoming; };
StreamStatus GetStatus () const { return m_Status; }; StreamStatus GetStatus () const { return m_Status; };
StreamingDestination& GetLocalDestination () { return m_LocalDestination; }; StreamingDestination& GetLocalDestination () { return m_LocalDestination; };
void ResetRoutingPath (); void ResetRoutingPath ();

Loading…
Cancel
Save