mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-12 05:48:51 -04:00
Make evhttp_bound_socket visible, and provide an accessor to its fd
Declare the previously private struct evhttp_bound_socket in event2/http.h as an opaque struct. Implement evhttp_bound_socket_get_fd, which returns the file descriptor of an evhttp_bound_socket. [Patch from David Reiss] svn:r1421
This commit is contained in:
parent
0755833e84
commit
4bcd5646d8
5
http.c
5
http.c
@ -2433,6 +2433,11 @@ evhttp_accept_socket(struct evhttp *http, evutil_socket_t fd)
|
||||
return (0);
|
||||
}
|
||||
|
||||
evutil_socket_t evhttp_bound_socket_get_fd(struct evhttp_bound_socket *bound)
|
||||
{
|
||||
return bound->bind_ev.ev_fd;
|
||||
}
|
||||
|
||||
static struct evhttp*
|
||||
evhttp_new_object(void)
|
||||
{
|
||||
|
@ -69,6 +69,7 @@ struct event_base;
|
||||
struct evhttp;
|
||||
struct evhttp_request;
|
||||
struct evkeyvalq;
|
||||
struct evhttp_bound_socket;
|
||||
|
||||
/**
|
||||
* Create a new HTTP server.
|
||||
@ -111,6 +112,15 @@ int evhttp_bind_socket(struct evhttp *http, const char *address, ev_uint16_t por
|
||||
*/
|
||||
int evhttp_accept_socket(struct evhttp *http, evutil_socket_t fd);
|
||||
|
||||
/**
|
||||
* Get the raw file descriptor referenced by an evhttp_bound_socket.
|
||||
*
|
||||
* @param bound_socket a handle returned by evhttp_{bind,accept}_socket_with_handle
|
||||
* @return the file descriptor used by the bound socket
|
||||
* @see evhttp_bind_socket_with_handle(), evhttp_accept_socket_with_handle()
|
||||
*/
|
||||
evutil_socket_t evhttp_bound_socket_get_fd(struct evhttp_bound_socket *bound_socket);
|
||||
|
||||
/**
|
||||
* Free the previously created HTTP server.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user