From 5e576a53abbf2822c0a8fcc87f76140a755599e4 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 10 Jun 2010 11:54:00 -0400 Subject: s3:lib make server contexts generic Pair-programmed-with: Andreas Schneider --- source3/smbd/globals.c | 17 +---------------- source3/smbd/server.c | 13 +------------ source3/smbd/server_exit.c | 4 ++-- 3 files changed, 4 insertions(+), 30 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c index 3150b9f67f..5df835d1aa 100644 --- a/source3/smbd/globals.c +++ b/source3/smbd/globals.c @@ -113,8 +113,6 @@ struct kernel_oplocks *koplocks = NULL; int am_parent = 1; int server_fd = -1; -struct event_context *smbd_event_ctx = NULL; -struct messaging_context *smbd_msg_ctx = NULL; struct memcache *smbd_memcache_ctx = NULL; bool exit_firsttime = true; struct child_pid *children = 0; @@ -124,20 +122,7 @@ struct smbd_server_connection *smbd_server_conn = NULL; struct messaging_context *smbd_messaging_context(void) { - if (smbd_msg_ctx == NULL) { - /* - * Note we MUST use the NULL context here, not the - * autofree context, to avoid side effects in forked - * children exiting. - */ - smbd_msg_ctx = messaging_init(NULL, - procid_self(), - smbd_event_context()); - } - if (smbd_msg_ctx == NULL) { - DEBUG(0, ("Could not init smbd messaging context.\n")); - } - return smbd_msg_ctx; + return server_messaging_context(); } struct memcache *smbd_memcache(void) diff --git a/source3/smbd/server.c b/source3/smbd/server.c index a7297d6863..2bb0bb87fe 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -49,18 +49,7 @@ int get_client_fd(void) struct event_context *smbd_event_context(void) { - if (!smbd_event_ctx) { - /* - * Note we MUST use the NULL context here, not the - * autofree context, to avoid side effects in forked - * children exiting. - */ - smbd_event_ctx = event_context_init(NULL); - } - if (!smbd_event_ctx) { - smb_panic("Could not init smbd event context"); - } - return smbd_event_ctx; + return server_event_context(); } /******************************************************************* diff --git a/source3/smbd/server_exit.c b/source3/smbd/server_exit.c index 3e0da3e1cf..1de9a0989c 100644 --- a/source3/smbd/server_exit.c +++ b/source3/smbd/server_exit.c @@ -119,8 +119,8 @@ static void exit_server_common(enum server_exit_reason how, */ sconn = NULL; TALLOC_FREE(smbd_server_conn); - TALLOC_FREE(smbd_msg_ctx); - TALLOC_FREE(smbd_event_ctx); + server_messaging_context_free(); + server_event_context_free(); TALLOC_FREE(smbd_memcache_ctx); if (how != SERVER_EXIT_NORMAL) { -- cgit