permit connection free from callback; from Ben Rigas

svn:r354
This commit is contained in:
Niels Provos 2007-05-12 06:23:52 +00:00
parent 4408a5f8fc
commit 5b5400f66b

7
http.c
View File

@ -573,12 +573,13 @@ void
evhttp_connection_done(struct evhttp_connection *evcon) evhttp_connection_done(struct evhttp_connection *evcon)
{ {
struct evhttp_request *req = TAILQ_FIRST(&evcon->requests); struct evhttp_request *req = TAILQ_FIRST(&evcon->requests);
int con_outgoing = evcon->flags & EVHTTP_CON_OUTGOING;
/* /*
* if this is an incoming connection, we need to leave the request * if this is an incoming connection, we need to leave the request
* on the connection, so that we can reply to it. * on the connection, so that we can reply to it.
*/ */
if (evcon->flags & EVHTTP_CON_OUTGOING) { if (con_outgoing) {
int need_close; int need_close;
TAILQ_REMOVE(&evcon->requests, req, next); TAILQ_REMOVE(&evcon->requests, req, next);
req->evcon = NULL; req->evcon = NULL;
@ -614,7 +615,7 @@ evhttp_connection_done(struct evhttp_connection *evcon)
(*req->cb)(req, req->cb_arg); (*req->cb)(req, req->cb_arg);
/* if this was an outgoing request, we own and it's done. so free it */ /* if this was an outgoing request, we own and it's done. so free it */
if (evcon->flags & EVHTTP_CON_OUTGOING) { if (con_outgoing) {
evhttp_request_free(req); evhttp_request_free(req);
} }
} }