Skip to content

Commit

Permalink
temirminate incoming right a way if no remote LeaseSet
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Nov 11, 2024
1 parent 09b7d44 commit dbef3fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libi2pd/Streaming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,12 @@ namespace stream
}
auto incomingStream = CreateNewIncomingStream (receiveStreamID);
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
{
Expand Down Expand Up @@ -1815,7 +1820,8 @@ namespace stream
{
std::unique_lock<std::mutex> l(m_StreamsMutex);
m_Streams.erase (stream->GetRecvStreamID ());
m_IncomingStreams.erase (stream->GetSendStreamID ());
if (stream->IsIncoming ())
m_IncomingStreams.erase (stream->GetSendStreamID ());
if (m_LastStream == stream) m_LastStream = nullptr;
}
auto ts = i2p::util::GetSecondsSinceEpoch ();
Expand Down
1 change: 1 addition & 0 deletions libi2pd/Streaming.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ namespace stream
std::shared_ptr<const i2p::data::IdentityEx> GetRemoteIdentity () const { return m_RemoteIdentity; };
bool IsOpen () const { return m_Status == eStreamStatusOpen; };
bool IsEstablished () const { return m_SendStreamID; };
bool IsIncoming () const { return m_IsIncoming; };
StreamStatus GetStatus () const { return m_Status; };
StreamingDestination& GetLocalDestination () { return m_LocalDestination; };
void ResetRoutingPath ();
Expand Down

0 comments on commit dbef3fe

Please sign in to comment.