svn commit: samba r20174 - in branches: SAMBA_3_0/source/lib SAMBA_3_0_24/source/lib

jra at samba.org jra at samba.org
Thu Dec 14 22:11:17 GMT 2006


Author: jra
Date: 2006-12-14 22:11:17 +0000 (Thu, 14 Dec 2006)
New Revision: 20174

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20174

Log:
If we're only going to call one handler per message
then terminate the traversal once we've done that.
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-14 17:00:10 UTC (rev 20173)
+++ branches/SAMBA_3_0/source/lib/messages.c	2006-12-14 22:11:17 UTC (rev 20174)
@@ -483,23 +483,23 @@
 		return;
 
 	for (buf = msgs_buf; message_recv(msgs_buf, total_len, &msg_type, &src, &buf, &len); buf += len) {
-		struct dispatch_fns *dfn, *next;
+		struct dispatch_fns *dfn;
 
 		DEBUG(10,("message_dispatch: received msg_type=%d "
 			  "src_pid=%u\n", msg_type,
 			  (unsigned int) procid_to_pid(&src)));
 
 		n_handled = 0;
-		for (dfn = dispatch_fns; dfn; dfn = next) {
-			next = dfn->next;			
+		for (dfn = dispatch_fns; dfn; dfn = dfn->next) {
 			if (dfn->msg_type == msg_type) {
 				DEBUG(10,("message_dispatch: processing message of type %d.\n", msg_type));
 				dfn->fn(msg_type, src, len ? (void *)buf : NULL, len);
 				n_handled++;
+				break;
 			}
 		}
 		if (!n_handled) {
-			DEBUG(5,("message_dispatch: warning: no handlers registed for "
+			DEBUG(5,("message_dispatch: warning: no handler registed for "
 				 "msg_type %d in pid %u\n",
 				 msg_type, (unsigned int)sys_getpid()));
 		}

Modified: branches/SAMBA_3_0_24/source/lib/messages.c
===================================================================
--- branches/SAMBA_3_0_24/source/lib/messages.c	2006-12-14 17:00:10 UTC (rev 20173)
+++ branches/SAMBA_3_0_24/source/lib/messages.c	2006-12-14 22:11:17 UTC (rev 20174)
@@ -483,23 +483,23 @@
 		return;
 
 	for (buf = msgs_buf; message_recv(msgs_buf, total_len, &msg_type, &src, &buf, &len); buf += len) {
-		struct dispatch_fns *dfn, *next;
+		struct dispatch_fns *dfn;
 
 		DEBUG(10,("message_dispatch: received msg_type=%d "
 			  "src_pid=%u\n", msg_type,
 			  (unsigned int) procid_to_pid(&src)));
 
 		n_handled = 0;
-		for (dfn = dispatch_fns; dfn; dfn = next) {
-			next = dfn->next;			
+		for (dfn = dispatch_fns; dfn; dfn = dfn->next) {
 			if (dfn->msg_type == msg_type) {
 				DEBUG(10,("message_dispatch: processing message of type %d.\n", msg_type));
 				dfn->fn(msg_type, src, len ? (void *)buf : NULL, len);
 				n_handled++;
+				break;
 			}
 		}
 		if (!n_handled) {
-			DEBUG(5,("message_dispatch: warning: no handlers registed for "
+			DEBUG(5,("message_dispatch: warning: no handler registed for "
 				 "msg_type %d in pid %u\n",
 				 msg_type, (unsigned int)sys_getpid()));
 		}



More information about the samba-cvs mailing list