summaryrefslogtreecommitdiff
path: root/source/lib/messages.c
diff options
context:
space:
mode:
authorbubulle <bubulle@alioth.debian.org>2009-03-13 21:27:21 +0000
committerbubulle <bubulle@alioth.debian.org>2009-03-13 21:27:21 +0000
commit60b302fa20e00a1f5645783f95efaa7d8f0ee34e (patch)
treedda0835f9a209c5a487570b8c08d6c2e1224e26f /source/lib/messages.c
parent7a15735eaa209f8dba887ffa180eb770389694de (diff)
downloadsamba-60b302fa20e00a1f5645783f95efaa7d8f0ee34e.tar.gz
Load samba-3.3.2 into branches/samba/upstream.upstream/3.3.2
git-svn-id: svn://svn.debian.org/svn/pkg-samba/branches/samba/upstream@2649 fc4039ab-9d04-0410-8cac-899223bdd6b0
Diffstat (limited to 'source/lib/messages.c')
-rw-r--r--source/lib/messages.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/source/lib/messages.c b/source/lib/messages.c
index f5933cafdb..6395cb6b3d 100644
--- a/source/lib/messages.c
+++ b/source/lib/messages.c
@@ -278,7 +278,15 @@ NTSTATUS messaging_register(struct messaging_context *msg_ctx,
*/
for (cb = msg_ctx->callbacks; cb != NULL; cb = cb->next) {
- if (cb->msg_type == msg_type) {
+ /* we allow a second registration of the same message
+ type if it has a different private pointer. This is
+ needed in, for example, the internal notify code,
+ which creates a new notify context for each tree
+ connect, and expects to receive messages to each of
+ them. */
+ if (cb->msg_type == msg_type && private_data == cb->private_data) {
+ DEBUG(5,("Overriding messaging pointer for type %u - private_data=%p\n",
+ (unsigned)msg_type, private_data));
cb->fn = fn;
cb->private_data = private_data;
return NT_STATUS_OK;
@@ -309,6 +317,8 @@ void messaging_deregister(struct messaging_context *ctx, uint32_t msg_type,
next = cb->next;
if ((cb->msg_type == msg_type)
&& (cb->private_data == private_data)) {
+ DEBUG(5,("Deregistering messaging pointer for type %u - private_data=%p\n",
+ (unsigned)msg_type, private_data));
DLIST_REMOVE(ctx->callbacks, cb);
TALLOC_FREE(cb);
}
@@ -354,7 +364,11 @@ void messaging_dispatch_rec(struct messaging_context *msg_ctx,
if (cb->msg_type == rec->msg_type) {
cb->fn(msg_ctx, cb->private_data, rec->msg_type,
rec->src, &rec->buf);
- return;
+ /* we continue looking for matching messages
+ after finding one. This matters for
+ subsystems like the internal notify code
+ which register more than one handler for
+ the same message type */
}
}
return;