diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-03-11 07:58:42 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-03-11 07:58:42 +1100 |
commit | 3d0a727f575942b767e396b694f6529259528a17 (patch) | |
tree | 8ea6acdfe1b043abe06a0f3d78dcbc1b55d6f146 /source3/lib/messages.c | |
parent | c218d3e1173355acf025471a10b4b6425b9c086b (diff) | |
parent | 3d280639c4652d6cd35577e333bcd46c2517754c (diff) | |
download | samba-3d0a727f575942b767e396b694f6529259528a17.tar.gz samba-3d0a727f575942b767e396b694f6529259528a17.tar.bz2 samba-3d0a727f575942b767e396b694f6529259528a17.zip |
Merge branch 'master' of ssh://git.samba.org/data/git/samba into wspp-schema
Diffstat (limited to 'source3/lib/messages.c')
-rw-r--r-- | source3/lib/messages.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/source3/lib/messages.c b/source3/lib/messages.c index e4b20c7493..5e11dd4e25 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -286,7 +286,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; @@ -317,6 +325,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); } @@ -362,7 +372,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; |