Skip to content

Commit

Permalink
don't return default destination if port is specified explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Apr 12, 2023
1 parent b8d21a1 commit 132557f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions libi2pd/Destination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,7 @@ namespace client
{
// streaming protocol
auto dest = GetStreamingDestination (toPort);
if (!dest) dest = m_StreamingDestination; // if no destination on port use default
if (dest)
dest->HandleDataMessagePayload (buf, length);
else
Expand Down Expand Up @@ -1236,8 +1237,9 @@ namespace client
if (it != m_StreamingDestinationsByPorts.end ())
return it->second;
}
// if port is zero or not found, use default destination
return m_StreamingDestination;
else // if port is zero, use default destination
return m_StreamingDestination;
return nullptr;
}

void ClientDestination::AcceptStreams (const i2p::stream::StreamingDestination::Acceptor& acceptor)
Expand Down
2 changes: 1 addition & 1 deletion libi2pd_client/I2PTunnel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ namespace client
{
if (!inport) inport = port;
m_PortDestination = localDestination->GetStreamingDestination (inport);
if (!m_PortDestination || (inport && (m_PortDestination == localDestination->GetStreamingDestination ()))) // default destination
if (!m_PortDestination) // default destination
m_PortDestination = localDestination->CreateStreamingDestination (inport, gzip);
}

Expand Down

0 comments on commit 132557f

Please sign in to comment.