From: Nick Mathewson Date: Sun, 16 Aug 2009 19:22:10 +0000 (+0000) Subject: Define evhttp_del_accept_socket X-Git-Tag: release-2.0.3-alpha~115 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c8b0fe4ad76bab55fd089ee1a01720e4af31c7f5;p=libevent Define evhttp_del_accept_socket [Patch from David Reiss] svn:r1423 --- diff --git a/http.c b/http.c index 2c94edb4..8fc1e7d3 100644 --- a/http.c +++ b/http.c @@ -2462,6 +2462,14 @@ evutil_socket_t evhttp_bound_socket_get_fd(struct evhttp_bound_socket *bound) return bound->bind_ev.ev_fd; } +void +evhttp_del_accept_socket(struct evhttp *http, struct evhttp_bound_socket *bound) +{ + TAILQ_REMOVE(&http->sockets, bound, next); + event_del(&bound->bind_ev); + mm_free(bound); +} + static struct evhttp* evhttp_new_object(void) { diff --git a/include/event2/http.h b/include/event2/http.h index c65b7f29..30cc5f16 100644 --- a/include/event2/http.h +++ b/include/event2/http.h @@ -137,6 +137,22 @@ int evhttp_accept_socket(struct evhttp *http, evutil_socket_t fd); */ struct evhttp_bound_socket *evhttp_accept_socket_with_handle(struct evhttp *http, evutil_socket_t fd); +/** + * Makes an HTTP server stop accepting connections on the specified socket + * + * This may be useful when a socket has been sent via file descriptor passing + * and is no longer needed by the current process. + * + * This function does not close the socket. + * + * \a bound_socket is an invalid pointer after this call returns. + * + * @param http a pointer to an evhttp object + * @param bound_socket a handle returned by evhttp_{bind,accept}_socket_with_handle + * @see evhttp_bind_socket_with_handle(), evhttp_accept_socket_with_handle() + */ +void evhttp_del_accept_socket(struct evhttp *http, struct evhttp_bound_socket *bound_socket); + /** * Get the raw file descriptor referenced by an evhttp_bound_socket. *