libevent 2.0 support

This commit is contained in:
Ondřej Kuzník 2018-04-10 09:26:56 +01:00
parent 513659c610
commit 00806dd32a
3 changed files with 9 additions and 6 deletions

View File

@ -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 )
} }
} }
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" );

View File

@ -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
} }

View File

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