From 2c12f8e72fb999f4f66700291dd4d7f6f73a8eae Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 16 Apr 2007 00:29:13 +0000 Subject: [PATCH] r22232: add a special message handler ID meaning "all messages please" This better fits the way Samba4 does message dispatch --- source/cluster/ctdb/common/ctdb_message.c | 2 +- source/cluster/ctdb/ctdb_cluster.c | 4 ++-- source/cluster/ctdb/include/ctdb.h | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/cluster/ctdb/common/ctdb_message.c b/source/cluster/ctdb/common/ctdb_message.c index dba15aecb93..ad88ec22d26 100644 --- a/source/cluster/ctdb/common/ctdb_message.c +++ b/source/cluster/ctdb/common/ctdb_message.c @@ -39,7 +39,7 @@ static int ctdb_dispatch_message(struct ctdb_context *ctdb, uint32_t srvid, TDB_ /* XXX we need a must faster way of finding the matching srvid - maybe a tree? */ for (ml=ctdb->message_list;ml;ml=ml->next) { - if (ml->srvid == srvid) break; + if (ml->srvid == srvid || ml->srvid == CTDB_SRVID_ALL) break; } if (ml == NULL) { printf("daemon vnn:%d no msg handler for srvid=%u\n", ctdb_get_vnn(ctdb), srvid); diff --git a/source/cluster/ctdb/ctdb_cluster.c b/source/cluster/ctdb/ctdb_cluster.c index aee47c6281e..82eea6a3d46 100644 --- a/source/cluster/ctdb/ctdb_cluster.c +++ b/source/cluster/ctdb/ctdb_cluster.c @@ -144,8 +144,8 @@ static NTSTATUS ctdb_message_init(struct cluster_ops *ops, int ret; /* setup messaging handler */ - ret = ctdb_set_message_handler(state->ctdb, ctdb_message_handler, - server.id, state); + ret = ctdb_set_message_handler(state->ctdb, CTDB_SRVID_ALL, + ctdb_message_handler, state); if (ret == -1) { DEBUG(0,("ctdb_set_message_handler failed - %s\n", ctdb_errstr(state->ctdb))); diff --git a/source/cluster/ctdb/include/ctdb.h b/source/cluster/ctdb/include/ctdb.h index d5a1b581e54..f24f1000a45 100644 --- a/source/cluster/ctdb/include/ctdb.h +++ b/source/cluster/ctdb/include/ctdb.h @@ -56,6 +56,11 @@ struct ctdb_call_info { #define CTDB_FLAG_CONNECT_WAIT (1<<2) +/* + a message handler ID meaning "give me all messages" + */ +#define CTDB_SRVID_ALL 0xFFFFFFFF + struct event_context; /* -- 2.11.4.GIT