bits.close: introduce connection close tracking

Make all code use connclose() and connkeep() when changing the "close
state" for a connection. These two macros take a string argument with an
explanation, and debug builds of curl will include that in the debug
output. Helps tracking connection re-use/close issues.
This commit is contained in:
Daniel Stenberg
2014-05-20 10:32:23 +02:00
parent 491767418b
commit df13f8e8c2
18 changed files with 85 additions and 48 deletions

View File

@@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2010, 2013, Howard Chu, <hyc@openldap.org>
* Copyright (C) 2011 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2011 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -46,6 +46,7 @@
#include "curl_ldap.h"
#include "curl_memory.h"
#include "curl_base64.h"
#include "connect.h"
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
@@ -175,7 +176,7 @@ static CURLcode ldap_setup(struct connectdata *conn)
return CURLE_OUT_OF_MEMORY;
li->proto = proto;
conn->proto.generic = li;
conn->bits.close = FALSE;
connkeep(conn, "OpenLDAP default");
/* TODO:
* - provide option to choose SASL Binds instead of Simple
*/
@@ -349,7 +350,7 @@ static CURLcode ldap_do(struct connectdata *conn, bool *done)
int msgid;
struct SessionHandle *data=conn->data;
conn->bits.close = FALSE;
connkeep(conn, "OpenLDAP do");
infof(data, "LDAP local: %s\n", data->change.url);