Move error reporting of messaging context creation fail into
[ira/wip.git] / source3 / nmbd / nmbd.c
index 2bae5f7b2720c2d1e452b4967828a6089a7550a9..d6943b19e671e1797e21184af69de6bd1910fa31 100644 (file)
@@ -43,26 +43,17 @@ time_t StartupTime = 0;
 
 struct event_context *nmbd_event_context(void)
 {
-       static struct event_context *ctx;
-
-       if (!ctx && !(ctx = event_context_init(NULL))) {
-               smb_panic("Could not init nmbd event context");
-       }
-       return ctx;
+       return server_event_context();
 }
 
 struct messaging_context *nmbd_messaging_context(void)
 {
-       static struct messaging_context *ctx;
-
-       if (ctx == NULL) {
-               ctx = messaging_init(NULL, procid_self(),
-                                    nmbd_event_context());
-       }
-       if (ctx == NULL) {
-               DEBUG(0, ("Could not init nmbd messaging context.\n"));
+       struct messaging_context *msg_ctx = server_messaging_context();
+       if (likely(msg_ctx != NULL)) {
+               return msg_ctx;
        }
-       return ctx;
+       smb_panic("Could not init nmbd's messaging context.\n");
+       return NULL;
 }
 
 /**************************************************************************** **