From 964e43c5e21482f9a0ff8f0be135c4ab8afa9330 Mon Sep 17 00:00:00 2001 From: Lindley French Date: Thu, 12 Jun 2014 11:36:41 -0700 Subject: conncache: move the connection counter to the cache struct The static connection counter caused a race condition. Moving the connection id counter into conncache solves it, as well as simplifying the related logic. --- lib/url.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'lib/url.c') diff --git a/lib/url.c b/lib/url.c index fba3bd391..770b0cc95 100644 --- a/lib/url.c +++ b/lib/url.c @@ -3254,19 +3254,7 @@ ConnectionDone(struct SessionHandle *data, struct connectdata *conn) static CURLcode ConnectionStore(struct SessionHandle *data, struct connectdata *conn) { - static int connection_id_counter = 0; - - CURLcode result; - - /* Assign a number to the connection for easier tracking in the log - output */ - conn->connection_id = connection_id_counter++; - - result = Curl_conncache_add_conn(data->state.conn_cache, conn); - if(result != CURLE_OK) - conn->connection_id = -1; - - return result; + return Curl_conncache_add_conn(data->state.conn_cache, conn); } /* after a TCP connection to the proxy has been verified, this function does -- cgit v1.2.3