Commit 00806dd3 authored by Ondřej Kuzník's avatar Ondřej Kuzník
Browse files

libevent 2.0 support

parent 513659c6
...@@ -1302,9 +1302,11 @@ lloadd_daemon( struct event_base *daemon_base ) ...@@ -1302,9 +1302,11 @@ lloadd_daemon( struct event_base *daemon_base )
assert( daemon_base != NULL ); assert( daemon_base != NULL );
dnsbase = evdns_base_new( daemon_base, #ifndef EVDNS_BASE_INITIALIZE_NAMESERVERS /* libevent 2.0 support */
EVDNS_BASE_INITIALIZE_NAMESERVERS | #define EVDNS_BASE_INITIALIZE_NAMESERVERS 1
EVDNS_BASE_DISABLE_WHEN_INACTIVE ); #endif /* !EVDNS_BASE_INITIALIZE_NAMESERVERS */
dnsbase = evdns_base_new( daemon_base, EVDNS_BASE_INITIALIZE_NAMESERVERS );
if ( !dnsbase ) { if ( !dnsbase ) {
Debug( LDAP_DEBUG_ANY, "lloadd startup: " Debug( LDAP_DEBUG_ANY, "lloadd startup: "
"failed to set up for async name resolution\n" ); "failed to set up for async name resolution\n" );
...@@ -1358,7 +1360,7 @@ lloadd_daemon( struct event_base *daemon_base ) ...@@ -1358,7 +1360,7 @@ lloadd_daemon( struct event_base *daemon_base )
} }
} }
event = evtimer_new( daemon_base, operations_timeout, event_self_cbarg() ); event = evtimer_new( daemon_base, operations_timeout, NULL );
if ( !event ) { if ( !event ) {
Debug( LDAP_DEBUG_ANY, "lloadd: " Debug( LDAP_DEBUG_ANY, "lloadd: "
"failed to allocate timeout event\n" ); "failed to allocate timeout event\n" );
......
...@@ -167,5 +167,7 @@ lload_libevent_init( void ) ...@@ -167,5 +167,7 @@ lload_libevent_init( void )
void void
lload_libevent_destroy( void ) lload_libevent_destroy( void )
{ {
#if ( EVENT__NUMERIC_VERSION >= 0x02010000 )
libevent_global_shutdown(); libevent_global_shutdown();
#endif
} }
...@@ -983,7 +983,6 @@ backend_timeout( ...@@ -983,7 +983,6 @@ backend_timeout(
void void
operations_timeout( evutil_socket_t s, short what, void *arg ) operations_timeout( evutil_socket_t s, short what, void *arg )
{ {
struct event *self = arg;
LloadBackend *b; LloadBackend *b;
time_t threshold; time_t threshold;
...@@ -1009,7 +1008,7 @@ operations_timeout( evutil_socket_t s, short what, void *arg ) ...@@ -1009,7 +1008,7 @@ operations_timeout( evutil_socket_t s, short what, void *arg )
done: done:
Debug( LDAP_DEBUG_TRACE, "operations_timeout: " Debug( LDAP_DEBUG_TRACE, "operations_timeout: "
"timeout task finished\n" ); "timeout task finished\n" );
evtimer_add( self, lload_timeout_api ); evtimer_add( lload_timeout_event, lload_timeout_api );
} }
void void
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment