Commit 22818e85 authored by Ondřej Kuzník's avatar Ondřej Kuzník
Browse files

Module shutdown

parent dab90547
......@@ -84,6 +84,7 @@ struct event_base *listener_base = NULL;
LloadListener **lload_listeners = NULL;
static ldap_pvt_thread_t listener_tid, *daemon_tid;
struct event_base *daemon_base = NULL;
struct evdns_base *dnsbase;
struct event *lload_timeout_event;
......
......@@ -376,8 +376,6 @@ main( int argc, char **argv )
int slapd_pid_file_unlink = 0, slapd_args_file_unlink = 0;
int firstopt = 1;
struct event_base *daemon_base = NULL;
slap_sl_mem_init();
serverName = lutil_progname( "lloadd", argc, argv );
......
......@@ -44,8 +44,9 @@ ldap_pvt_thread_t lloadd_main_thread;
void *
lload_start_daemon( void *arg )
{
struct event_base *daemon_base = event_base_new();
int rc = 0, i;
daemon_base = event_base_new();
if ( !daemon_base ) {
Debug( LDAP_DEBUG_ANY, "lload_start_daemon: "
"main event base allocation failed\n" );
......@@ -102,13 +103,26 @@ lload_back_open( BackendInfo *bi )
&lloadd_main_thread, 0, lload_start_daemon, NULL );
}
int
lload_back_close( BackendInfo *bi )
{
if ( slapMode & SLAP_TOOL_MODE ) {
return 0;
}
event_base_loopexit( daemon_base, NULL );
ldap_pvt_thread_join( lloadd_main_thread, (void *)NULL );
return 0;
}
int
lload_back_initialize( BackendInfo *bi )
{
bi->bi_flags = SLAP_BFLAG_STANDALONE;
bi->bi_open = lload_back_open;
bi->bi_config = config_generic_wrapper;
bi->bi_close = 0;
bi->bi_close = lload_back_close;
bi->bi_destroy = 0;
bi->bi_db_init = 0;
......
......@@ -104,6 +104,7 @@ LDAP_SLAPD_V (int) lload_daemon_mask;
LDAP_SLAPD_F (void) lload_sig_shutdown( evutil_socket_t sig, short what, void *arg );
LDAP_SLAPD_V (struct event_base *) daemon_base;
LDAP_SLAPD_V (struct evdns_base *) dnsbase;
LDAP_SLAPD_V (volatile sig_atomic_t) slapd_shutdown;
LDAP_SLAPD_V (volatile sig_atomic_t) slapd_gentle_shutdown;
......
Markdown is supported
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