From: Daniel Stenberg <daniel@haxx.se>
Date: Thu, 19 Jun 2008 08:31:22 +0000 (+0000)
Subject: - Dengminwen found a bug in the connection re-use function when using the
X-Git-Tag: cares-1_5_3~426
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fb2e71b9bd352bca7e3a5533c69bd236132a5d7a;p=curl

- Dengminwen found a bug in the connection re-use function when using the
  multi interface with pipelining enabled as it would wrongly check for,
  detect and close "dead connections" even though that connection was already
  in use!
---

diff --git a/CHANGES b/CHANGES
index aa6997951..1d137577c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,12 @@
 
                                   Changelog
 
+Daniel Stenberg (19 Jun 2008)
+- Dengminwen found a bug in the connection re-use function when using the
+  multi interface with pipelining enabled as it would wrongly check for,
+  detect and close "dead connections" even though that connection was already
+  in use!
+
 Daniel Fandrich (18 Jun 2008)
 - Added SSH failure test cases 628-632
 
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 50ea7ad7b..3201397e2 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -20,6 +20,7 @@ This release includes the following bugfixes:
 
  o Fixed curl-config --ca
  o Fixed the multi interface connection re-use with NSS-built libcurl
+ o connection re-use when using the multi interface with pipelining enabled
 
 This release includes the following known bugs:
 
@@ -37,6 +38,6 @@ This release would not have looked like this without help, code, reports and
 advice from friends like these:
 
  Lenny Rachitsky, Axel Tillequin, Arnaud Ebalard, Yang Tse, Dan Fandrich,
- Rob Crittenden
+ Rob Crittenden, Dengminwen
 
         Thanks! (and sorry if I forgot to mention someone)
diff --git a/lib/url.c b/lib/url.c
index a7f1a0c1a..6391edb28 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2511,9 +2511,10 @@ ConnectionExists(struct SessionHandle *data,
     }
 
     if(match) {
-      if(pipeLen == 0) {
-        /* The check for a dead socket makes sense only if there
-           are no handles in pipeline */
+      if(!pipeLen && !check->inuse) {
+        /* The check for a dead socket makes sense only if there are no
+           handles in pipeline and the connection isn't already marked in
+           use */
         bool dead = SocketIsDead(check->sock[FIRSTSOCKET]);
         if(dead) {
           check->data = data;