Define evhttp_del_accept_socket

[Patch from David Reiss]

svn:r1423
This commit is contained in:
Nick Mathewson 2009-08-16 19:22:10 +00:00
parent 6c53334c65
commit c8b0fe4ad7
2 changed files with 24 additions and 0 deletions

8
http.c
View File

@ -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)
{

View File

@ -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.
*