summaryrefslogtreecommitdiff
path: root/source3/lib/messages.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/messages.c')
-rw-r--r--source3/lib/messages.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index b796e1472c..54657d8d56 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -205,6 +205,19 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
return NULL;
}
+#ifdef CLUSTER_SUPPORT
+ if (lp_clustering()) {
+ status = messaging_ctdbd_init(ctx, ctx, &ctx->remote);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("messaging_ctdb_init failed: %s\n",
+ nt_errstr(status)));
+ TALLOC_FREE(ctx);
+ return NULL;
+ }
+ }
+#endif
+
messaging_register(ctx, NULL, MSG_PING, ping_message);
/* Register some debugging related messages */
@@ -217,6 +230,34 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
}
/*
+ * re-init after a fork
+ */
+NTSTATUS messaging_reinit(struct messaging_context *msg_ctx)
+{
+#ifdef CLUSTER_SUPPORT
+
+ TALLOC_FREE(msg_ctx->remote);
+
+ if (lp_clustering()) {
+ NTSTATUS status;
+
+ status = messaging_ctdbd_init(msg_ctx, msg_ctx,
+ &msg_ctx->remote);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("messaging_ctdb_init failed: %s\n",
+ nt_errstr(status)));
+ return status;
+ }
+ }
+
+#endif
+
+ return NT_STATUS_OK;
+}
+
+
+/*
* Register a dispatch function for a particular message type. Allow multiple
* registrants
*/