]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 5132: Close the tunnel if to-server conn closes after client (#957)
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 9 Jan 2022 10:41:24 +0000 (10:41 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Fri, 21 Jan 2022 14:32:26 +0000 (03:32 +1300)
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.

src/tunnel.cc

index eb0654403252398f8ff5e289cff2aafc02e2e38b..159669be5d786ecb2369029e91972b5794c3762a 100644 (file)
@@ -316,6 +316,8 @@ void
 TunnelStateData::serverClosed()
 {
     server.noteClosure();
+
+    retryOrBail(__FUNCTION__);
 }
 
 /// TunnelStateData::clientClosed() wrapper
@@ -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();