diff options
author | Azat Khuzhin <azat@libevent.org> | 2020-05-19 01:02:30 +0300 |
---|---|---|
committer | Azat Khuzhin <azat@libevent.org> | 2020-05-19 01:06:12 +0300 |
commit | 083c6d54d50462f8112328e75bf30647b2e1789e (patch) | |
tree | 8df0d9752d68ebb20e9b4fb2eb2273617168b48b /http.c | |
parent | 70f69194eb3b19b5e41b52b17a820e1e91512560 (diff) | |
download | libevent-083c6d54d50462f8112328e75bf30647b2e1789e.tar.gz |
http: fix EVHTTP_CON_AUTOFREE in case of connection error
Refs: #182
Diffstat (limited to 'http.c')
-rw-r--r-- | http.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -1492,8 +1492,10 @@ static void evhttp_connection_cb_cleanup(struct evhttp_connection *evcon) { struct evcon_requestq requests; + EVUTIL_ASSERT(evcon->flags & EVHTTP_CON_OUTGOING); evhttp_connection_reset_(evcon); + if (evcon->retry_max < 0 || evcon->retry_cnt < evcon->retry_max) { struct timeval tv_retry = evcon->initial_retry_timeout; int i; @@ -1539,6 +1541,12 @@ evhttp_connection_cb_cleanup(struct evhttp_connection *evcon) request->cb(request, request->cb_arg); evhttp_request_free_auto(request); } + + if (TAILQ_FIRST(&evcon->requests) == NULL + && (evcon->flags & EVHTTP_CON_AUTOFREE)) { + evhttp_connection_free(evcon); + } + } static void |