svn commit: samba r20165 - in branches: SAMBA_3_0/source/lib
SAMBA_3_0_24/source/lib
jra at samba.org
jra at samba.org
Thu Dec 14 01:00:25 GMT 2006
Author: jra
Date: 2006-12-14 01:00:16 +0000 (Thu, 14 Dec 2006)
New Revision: 20165
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20165
Log:
Change messaging subsystem to only allow one message
per type - this is all we use right now and makes
re-entrancy problems with deleting handlers with
a message dispatch loop go away.
Jeremy.
Modified:
branches/SAMBA_3_0/source/lib/messages.c
branches/SAMBA_3_0_24/source/lib/messages.c
Changeset:
Modified: branches/SAMBA_3_0/source/lib/messages.c
===================================================================
--- branches/SAMBA_3_0/source/lib/messages.c 2006-12-13 23:53:42 UTC (rev 20164)
+++ branches/SAMBA_3_0/source/lib/messages.c 2006-12-14 01:00:16 UTC (rev 20165)
@@ -458,8 +458,7 @@
/****************************************************************************
Receive and dispatch any messages pending for this process.
- Notice that all dispatch handlers for a particular msg_type get called,
- so you can register multiple handlers for a message.
+ JRA changed Dec 13 2006. Only one message handler now permitted per type.
*NOTE*: Dispatch functions must be able to cope with incoming
messages on an *odd* byte boundary.
****************************************************************************/
@@ -509,7 +508,8 @@
}
/****************************************************************************
- Register a dispatch function for a particular message type.
+ Register/replace a dispatch function for a particular message type.
+ JRA changed Dec 13 2006. Only one message handler now permitted per type.
*NOTE*: Dispatch functions must be able to cope with incoming
messages on an *odd* byte boundary.
****************************************************************************/
@@ -520,6 +520,13 @@
{
struct dispatch_fns *dfn;
+ for (dfn = dispatch_fns; dfn; dfn = dfn->next) {
+ if (dfn->msg_type == msg_type) {
+ dfn->fn = fn;
+ return;
+ }
+ }
+
dfn = SMB_MALLOC_P(struct dispatch_fns);
if (dfn != NULL) {
@@ -550,6 +557,7 @@
if (dfn->msg_type == msg_type) {
DLIST_REMOVE(dispatch_fns, dfn);
SAFE_FREE(dfn);
+ return;
}
}
}
Modified: branches/SAMBA_3_0_24/source/lib/messages.c
===================================================================
--- branches/SAMBA_3_0_24/source/lib/messages.c 2006-12-13 23:53:42 UTC (rev 20164)
+++ branches/SAMBA_3_0_24/source/lib/messages.c 2006-12-14 01:00:16 UTC (rev 20165)
@@ -458,8 +458,7 @@
/****************************************************************************
Receive and dispatch any messages pending for this process.
- Notice that all dispatch handlers for a particular msg_type get called,
- so you can register multiple handlers for a message.
+ JRA changed Dec 13 2006. Only one message handler now permitted per type.
*NOTE*: Dispatch functions must be able to cope with incoming
messages on an *odd* byte boundary.
****************************************************************************/
@@ -509,7 +508,8 @@
}
/****************************************************************************
- Register a dispatch function for a particular message type.
+ Register/replace a dispatch function for a particular message type.
+ JRA changed Dec 13 2006. Only one message handler now permitted per type.
*NOTE*: Dispatch functions must be able to cope with incoming
messages on an *odd* byte boundary.
****************************************************************************/
@@ -520,6 +520,13 @@
{
struct dispatch_fns *dfn;
+ for (dfn = dispatch_fns; dfn; dfn = dfn->next) {
+ if (dfn->msg_type == msg_type) {
+ dfn->fn = fn;
+ return;
+ }
+ }
+
dfn = SMB_MALLOC_P(struct dispatch_fns);
if (dfn != NULL) {
@@ -550,6 +557,7 @@
if (dfn->msg_type == msg_type) {
DLIST_REMOVE(dispatch_fns, dfn);
SAFE_FREE(dfn);
+ return;
}
}
}
More information about the samba-cvs
mailing list