aboutsummaryrefslogtreecommitdiff
path: root/lib/connect.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2014-05-20 10:32:23 +0200
committerDaniel Stenberg <daniel@haxx.se>2014-05-22 00:34:10 +0200
commitdf13f8e8c2199b572f19d295e5c59e7502204b3a (patch)
treeb664dc79f3de9d810f13dd01decbd0b03fcb06b5 /lib/connect.h
parent491767418bd3e69867d48c2f9b4ea58f7112a879 (diff)
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.
Diffstat (limited to 'lib/connect.h')
-rw-r--r--lib/connect.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/connect.h b/lib/connect.h
index 89653f70a..7bc391bef 100644
--- a/lib/connect.h
+++ b/lib/connect.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 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
@@ -102,4 +102,21 @@ CURLcode Curl_socket(struct connectdata *conn,
struct Curl_sockaddr_ex *addr,
curl_socket_t *sockfd);
+#ifdef CURLDEBUG
+/*
+ * Curl_connclose() sets the bit.close bit to TRUE with an explanation.
+ * Nothing else.
+ */
+void Curl_conncontrol(struct connectdata *conn,
+ bool closeit,
+ const char *reason);
+#define connclose(x,y) Curl_conncontrol(x,TRUE, y)
+#define connkeep(x,y) Curl_conncontrol(x, FALSE, y)
+#else /* if !CURLDEBUG */
+
+#define connclose(x,y) (x)->bits.close = TRUE
+#define connkeep(x,y) (x)->bits.close = FALSE
+
+#endif
+
#endif /* HEADER_CURL_CONNECT_H */