mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
permit connection free from callback; from Ben Rigas
svn:r354
This commit is contained in:
parent
4408a5f8fc
commit
5b5400f66b
7
http.c
7
http.c
@ -573,12 +573,13 @@ void
|
||||
evhttp_connection_done(struct evhttp_connection *evcon)
|
||||
{
|
||||
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
|
||||
* on the connection, so that we can reply to it.
|
||||
*/
|
||||
if (evcon->flags & EVHTTP_CON_OUTGOING) {
|
||||
if (con_outgoing) {
|
||||
int need_close;
|
||||
TAILQ_REMOVE(&evcon->requests, req, next);
|
||||
req->evcon = NULL;
|
||||
@ -614,7 +615,7 @@ evhttp_connection_done(struct evhttp_connection *evcon)
|
||||
(*req->cb)(req, req->cb_arg);
|
||||
|
||||
/* 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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user