summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2010-06-10 11:54:00 -0400
committerSimo Sorce <idra@samba.org>2010-06-10 17:30:45 -0400
commit5e576a53abbf2822c0a8fcc87f76140a755599e4 (patch)
treef026e75c6e9ab5e3dc3631be43930868ce76d077 /source3/smbd
parentaeb25ad0b87af2a2af7735f49744a677ebf4fe06 (diff)
downloadsamba-5e576a53abbf2822c0a8fcc87f76140a755599e4.tar.gz
samba-5e576a53abbf2822c0a8fcc87f76140a755599e4.tar.bz2
samba-5e576a53abbf2822c0a8fcc87f76140a755599e4.zip
s3:lib make server contexts generic
Pair-programmed-with: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/globals.c17
-rw-r--r--source3/smbd/server.c13
-rw-r--r--source3/smbd/server_exit.c4
3 files changed, 4 insertions, 30 deletions
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) {