From: Daniel Stenberg Date: Mon, 11 Sep 2006 20:50:58 +0000 (+0000) Subject: If the current connection doesn't fit to get added to the connection cache, X-Git-Tag: upstream/7.37.1~10029 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7c5745720aca27f38dc875a39d43cc3aba189471;p=platform%2Fupstream%2Fcurl.git If the current connection doesn't fit to get added to the connection cache, we certainly MUST NOT kill an active connection... Problem tracked down thanks to Michael Wallner's excellent test program. --- diff --git a/lib/url.c b/lib/url.c index 14def32..e014c8e 100644 --- a/lib/url.c +++ b/lib/url.c @@ -2002,7 +2002,7 @@ ConnectionKillOne(struct SessionHandle *data) for(i=0; data->state.connc && (i< data->state.connc->num); i++) { conn = data->state.connc->connects[i]; - if(!conn) + if(!conn || conn->inuse) continue; /* @@ -2078,7 +2078,10 @@ ConnectionStore(struct SessionHandle *data, if(i == data->state.connc->num) { /* there was no room available, kill one */ i = ConnectionKillOne(data); - infof(data, "Connection (#%d) was killed to make room\n", i); + if(-1 != i) + infof(data, "Connection (#%d) was killed to make room\n", i); + else + infof(data, "This connection did not fit in the connection cache\n"); } conn->connectindex = i; /* Make the child know where the pointer to this