From: Nick Mathewson Date: Thu, 30 Jul 2009 17:00:56 +0000 (+0000) Subject: Accessor function to get a listener's associated fd X-Git-Tag: release-2.0.3-alpha~148 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=75fe762e03be63577ccbfa78baf9c78e8be40d7f;p=libevent Accessor function to get a listener's associated fd svn:r1390 --- diff --git a/ChangeLog b/ChangeLog index d18d5bc3..1566120e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,7 +4,7 @@ Changes in 2.0.3-alpha: o Avoid segfault during failed allocation of locked evdns_base. (Found by Rocco Carbone.) o Export new evutil_ascii_* functions to perform locale-independent character type operations. o Try to compile better with MSVC: patches from Brodie Thiesfield - + o New evconnlistener_get_fd function to expose a listener's associated socket. Changes in 2.0.2-alpha: o Add a new flag to bufferevents to make all callbacks automatically deferred. diff --git a/include/event2/listener.h b/include/event2/listener.h index 702eaa1e..9edf5991 100644 --- a/include/event2/listener.h +++ b/include/event2/listener.h @@ -105,4 +105,7 @@ int evconnlistener_disable(struct evconnlistener *lev); /** Return an evconnlistener's associated event_base. */ struct event_base *evconnlistener_get_base(struct evconnlistener *lev); +/** Return the socket that an evconnlistner is listening on. */ +evutil_socket_t evconnlistener_get_fd(struct evconnlistener *lev); + #endif diff --git a/listener.c b/listener.c index bd7176d5..3051c805 100644 --- a/listener.c +++ b/listener.c @@ -153,6 +153,12 @@ evconnlistener_get_base(struct evconnlistener *lev) return event_get_base(&lev->listener); } +evutil_socket_t +evconnlistener_get_fd(struct evconnlistener *lev) +{ + return event_get_fd(&lev->listener); +} + static void listener_read_cb(evutil_socket_t fd, short what, void *p) {