aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-05-17 08:05:46 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-05-17 08:05:46 +0000
commit8001921112f726c10caa09d0725f90230636dea6 (patch)
tree7e9bd378737fd740ba24e4f3e76520e3a617a91d /lib/url.c
parentd7cb09bd18f98dd870198e9474f4315f48d28daa (diff)
I made Curl_done() take a pointer-pointer in the first argument instead, and
if the connection is killed it blanks the pointer it points to, to make it easier to detect usage problems whereever Curl_done() is used.
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/url.c b/lib/url.c
index 9c4769dfa..53d37baa6 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -3367,12 +3367,13 @@ CURLcode Curl_async_resolved(struct connectdata *conn)
}
-CURLcode Curl_done(struct connectdata *conn,
+CURLcode Curl_done(struct connectdata **connp,
CURLcode status) /* an error if this is called after an
error was detected */
{
- struct SessionHandle *data=conn->data;
CURLcode result;
+ struct connectdata *conn = *connp;
+ struct SessionHandle *data=conn->data;
/* cleanups done even if the connection is re-used */
@@ -3416,6 +3417,9 @@ CURLcode Curl_done(struct connectdata *conn,
CURLcode res2;
res2 = Curl_disconnect(conn); /* close the connection */
+ *connp = NULL; /* to make the caller of this function better detect that
+ this was actually killed here */
+
/* If we had an error already, make sure we return that one. But
if we got a new error, return that. */
if(!result && res2)
@@ -3452,9 +3456,9 @@ CURLcode Curl_do(struct connectdata **connp)
infof(data, "Re-used connection seems dead, get a new one\n");
conn->bits.close = TRUE; /* enforce close of this connection */
- result = Curl_done(conn, result); /* we are so done with this */
+ result = Curl_done(&conn, result); /* we are so done with this */
- /* conn is no longer a good pointer */
+ /* conn may no longer be a good pointer */
if(CURLE_OK == result) {
bool async;