Skip to content

Commit

Permalink
Bug 5132: Close the tunnel if to-server conn closes after client (squ…
Browse files Browse the repository at this point in the history
…id-cache#957)

Since commit 25d2603, blind CONNECT tunnel "jobs" (and equivalent) were
not destroyed upon a "lonely" to-server connection closure, leading to
memory leaks. And when a from-client connection was still present at the
time of the to-server connection closure, we did not try to reforward,
violating the spirit of commit 25d2603 changes. Calling retryOrBail() is
sufficient to handle both cases.
  • Loading branch information
rousskov authored and yadij committed Jan 21, 2022
1 parent 3469d66 commit 54ad10e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/tunnel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ void
TunnelStateData::serverClosed()
{
server.noteClosure();

retryOrBail(__FUNCTION__);
}

/// TunnelStateData::clientClosed() wrapper
Expand Down Expand Up @@ -418,9 +420,6 @@ TunnelStateData::checkRetry()
void
TunnelStateData::retryOrBail(const char *context)
{
// Since no TCP payload has been passed to client or server, we may
// TCP-connect to other destinations (including alternate IPs).

assert(!server.conn);

const auto *bailDescription = checkRetry();
Expand Down

0 comments on commit 54ad10e

Please sign in to comment.