From ee73fc361ba33a2c6308bac1a75e3c0b8fe639eb Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 3 Mar 2009 11:01:24 +0000 Subject: - David James brought a patch that make libcurl close (all) dead connections whenever you attempt to open a new connection. --- CHANGES | 11 +++++++++++ RELEASE-NOTES | 5 +++-- lib/url.c | 32 ++++++++++++++++---------------- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/CHANGES b/CHANGES index 10e6b7d48..4d9c5d4ae 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,17 @@ Changelog +Daniel Stenberg (3 Mar 2009) +- David James brought a patch that make libcurl close (all) dead connections + whenever you attempt to open a new connection. + + 1. After cleaning up a dead connection, "continue" instead of + returning FALSE. This ensures that we clean up all dead connections, + rather than just cleaning up the first dead connection. + 2. Move up the cleanup for dead connections so that it occurs for + all connections, rather than just the connections which have the same + preferences as our current new connection. + Version 7.19.4 (3 March 2009) Daniel Stenberg (3 Mar 2009) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index badec7854..2dc9daf81 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -9,7 +9,8 @@ Curl and libcurl 7.19.5 This release includes the following changes: - o + o libcurl now closes all dead connections whenever you attempt to open a new + connection This release includes the following bugfixes: @@ -22,6 +23,6 @@ This release includes the following known bugs: This release would not have looked like this without help, code, reports and advice from friends like these: - + David James Thanks! (and sorry if I forgot to mention someone) diff --git a/lib/url.c b/lib/url.c index 6d2e6d4b7..22b8f7dfd 100644 --- a/lib/url.c +++ b/lib/url.c @@ -2565,6 +2565,22 @@ ConnectionExists(struct SessionHandle *data, from the multi */ } + 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; + infof(data, "Connection #%d seems to be dead!\n", i); + + Curl_disconnect(check); /* disconnect resources */ + data->state.connc->connects[i]=NULL; /* nothing here */ + + continue; + } + } + if(canPipeline) { /* Make sure the pipe has only GET requests */ struct SessionHandle* sh = gethandleathead(check->send_pipe); @@ -2688,22 +2704,6 @@ ConnectionExists(struct SessionHandle *data, } if(match) { - 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; - infof(data, "Connection #%d seems to be dead!\n", i); - - Curl_disconnect(check); /* disconnect resources */ - data->state.connc->connects[i]=NULL; /* nothing here */ - - return FALSE; - } - } - check->inuse = TRUE; /* mark this as being in use so that no other handle in a multi stack may nick it */ -- cgit v1.2.3