Author: vlendec
Date: 2006-06-08 14:44:16 +0000 (Thu, 08 Jun 2006)
New Revision: 16098

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

Log:
Reformatting
Modified:
   branches/tmp/vl-messaging/source/lib/messages.c


Changeset:
Modified: branches/tmp/vl-messaging/source/lib/messages.c
===================================================================
--- branches/tmp/vl-messaging/source/lib/messages.c     2006-06-08 14:39:22 UTC 
(rev 16097)
+++ branches/tmp/vl-messaging/source/lib/messages.c     2006-06-08 14:44:16 UTC 
(rev 16098)
@@ -52,11 +52,11 @@
 
 /* main messaging functions - they point to the selected implementation */
 static BOOL (*message_send_pid_func)(struct process_id pid, int msg_type,
-                                                                        const 
void *buf, size_t len,
-                                                                        BOOL 
duplicates_allowed,
-                                                                        
unsigned int timeout);
+                                    const void *buf, size_t len,
+                                    BOOL duplicates_allowed,
+                                    unsigned int timeout);
 static void (*message_select_setup_func)(int *maxfd,
-                                                                       fd_set 
*rfds, fd_set *wfds);
+                                        fd_set *rfds, fd_set *wfds);
 static unsigned int (*message_receive_func)(fd_set *rfds, fd_set *wfds);
 static BOOL (*retrieve_all_messages_func)(struct message_list **list);
 
@@ -124,8 +124,7 @@
        case MESSAGING_TYPE_STREAM:
 #endif /* WITH_STREAM_MESSAGING */
 
-#if defined(WITH_DGRAM_MESSAGING) ||                                           
\
-       defined(WITH_STREAM_MESSAGING)
+#if defined(WITH_DGRAM_MESSAGING) || defined(WITH_STREAM_MESSAGING)
                message_send_pid_func = message_send_pid_socket;
                message_select_setup_func = message_select_setup_socket;
                message_receive_func = message_receive_socket;
@@ -156,10 +155,9 @@
 
 BOOL message_reinit(void)
 {
-#if defined(WITH_DGRAM_MESSAGING) ||                                           
                        \
-       defined(WITH_STREAM_MESSAGING)
+#if defined(WITH_DGRAM_MESSAGING) || defined(WITH_STREAM_MESSAGING)
        if ((enum messaging_type)lp_messaging_type() == MESSAGING_TYPE_DGRAM ||
-               (enum messaging_type)lp_messaging_type() == 
MESSAGING_TYPE_STREAM) {
+           (enum messaging_type)lp_messaging_type() == MESSAGING_TYPE_STREAM) {
                shutdown_sockets();
                return message_init_socket();
        }
@@ -173,10 +171,9 @@
 
 BOOL message_end(void)
 {
-#if defined(WITH_DGRAM_MESSAGING) ||                                           
                        \
-       defined(WITH_STREAM_MESSAGING)
+#if defined(WITH_DGRAM_MESSAGING) || defined(WITH_STREAM_MESSAGING)
        if ((enum messaging_type)lp_messaging_type() == MESSAGING_TYPE_DGRAM ||
-               (enum messaging_type)lp_messaging_type() == 
MESSAGING_TYPE_STREAM) {
+           (enum messaging_type)lp_messaging_type() == MESSAGING_TYPE_STREAM) {
                shutdown_sockets();
        }
 #endif /* WITH_(DGRAM or STREAM)_MESSAGING */
@@ -199,7 +196,7 @@
 {
        SMB_ASSERT(message_send_pid_func != NULL);
        return message_send_pid_func(pid, msg_type, buf, len,
-                                                                
duplicates_allowed, timeout);
+                                    duplicates_allowed, timeout);
 }
 
 /****************************************************************************
@@ -209,17 +206,20 @@
 BOOL message_send_pid(struct process_id pid, int msg_type, const void *buf,
                                          size_t len, BOOL duplicates_allowed)
 {
-       return message_send_pid_internal(pid, msg_type, buf, len, 
duplicates_allowed, 0);
+       return message_send_pid_internal(pid, msg_type, buf, len,
+                                        duplicates_allowed, 0);
 }
 
 /****************************************************************************
  Send a message to a particular pid, with timeout in seconds.
 ****************************************************************************/
 
-BOOL message_send_pid_with_timeout(struct process_id pid, int msg_type, const 
void *buf, size_t len,
+BOOL message_send_pid_with_timeout(struct process_id pid, int msg_type,
+                                  const void *buf, size_t len,
                BOOL duplicates_allowed, unsigned int timeout)
 {
-       return message_send_pid_internal(pid, msg_type, buf, len, 
duplicates_allowed, timeout);
+       return message_send_pid_internal(pid, msg_type, buf, len,
+                                        duplicates_allowed, timeout);
 }
 
 /****************************************************************************
@@ -234,10 +234,9 @@
        } else 
 #endif /* WITH_TDB_MESSAGING */        
 
-#if defined(WITH_DGRAM_MESSAGING) ||                                           
                        \
-       defined(WITH_STREAM_MESSAGING)
+#if defined(WITH_DGRAM_MESSAGING) || defined(WITH_STREAM_MESSAGING)
        if ((enum messaging_type)lp_messaging_type() == MESSAGING_TYPE_DGRAM ||
-               (enum messaging_type)lp_messaging_type() == 
MESSAGING_TYPE_STREAM) {
+           (enum messaging_type)lp_messaging_type() == MESSAGING_TYPE_STREAM) {
                return messages_pending_for_pid_socket(pid);
        } else 
 #endif /* WITH_(DGRAM or STREAM)_MESSAGING */
@@ -309,21 +308,24 @@
                          (unsigned int) procid_to_pid(&msg->src)));
                n_handled = 0;
                for (dfn = dispatch_fns; dfn; dfn = dfn->next) {
-                       if (dfn->msg_type == msg->msg_type) {
-                               DEBUG(10,("message_dispatch: processing message 
of type %d.\n", msg->msg_type));
-                               if(msg->len == sizeof(struct message_rec)) {
-                                       dfn->fn(msg->msg_type, msg->src, NULL, 
0);
-                               } else {
-                                       dfn->fn(msg->msg_type, msg->src, 
-                                                       (void *)((uint8_t*)msg 
+ sizeof(struct message_rec)),
-                                                       msg->len - 
sizeof(struct message_rec));
-                               }
-                               n_handled++;
+                       if (dfn->msg_type != msg->msg_type) {
+                               continue;
                        }
+                       DEBUG(10,("message_dispatch: processing message "
+                                 "of type %d.\n", msg->msg_type));
+                       if(msg->len == sizeof(struct message_rec)) {
+                               dfn->fn(msg->msg_type, msg->src, NULL, 0);
+                       } else {
+                               dfn->fn(msg->msg_type, msg->src, 
+                                       (void *)((uint8_t*)msg +
+                                                sizeof(struct message_rec)),
+                                       msg->len - sizeof(struct message_rec));
+                       }
+                       n_handled++;
                }
                if (!n_handled) {
-                       DEBUG(5,("message_dispatch: warning: no handlers 
registed for "
-                                "msg_type %d in pid %u\n",
+                       DEBUG(5,("message_dispatch: warning: no handlers "
+                                "registed for msg_type %d in pid %u\n",
                                msg-> msg_type, (unsigned int)sys_getpid()));
                }
        }
@@ -388,8 +390,8 @@
                DLIST_ADD(dispatch_fns, dfn);
        }
        else {
-       
-               DEBUG(0,("message_register: Not enough memory. malloc 
failed!\n"));
+               DEBUG(0,("message_register: Not enough memory. malloc "
+                        "failed!\n"));
        }
 }
 
@@ -423,7 +425,8 @@
  Send one of the messages for the broadcast.
 ****************************************************************************/
 
-static int traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DATA dbuf, 
void *state)
+static int traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DATA dbuf,
+                      void *state)
 {
        struct connections_data crec;
        struct msg_all *msg_all = (struct msg_all *)state;
@@ -441,17 +444,19 @@
        if(!(crec.bcast_msg_flags & msg_all->msg_flag))
                return 0;
 
-       /* If the msg send fails because the pid was not found (i.e. smbd 
died), 
-        * the msg has already been deleted from the messages.tdb.*/
+       /* If the msg send fails because the pid was not found (i.e. smbd
+        * died), the msg has already been deleted from the messages.tdb.*/
 
        if (!message_send_pid(crec.pid, msg_all->msg_type,
                              msg_all->buf, msg_all->len,
                              msg_all->duplicates)) {
                
-               /* If the pid was not found delete the entry from 
connections.tdb */
+               /* If the pid was not found delete the entry from
+                * connections.tdb */
 
                if (errno == ESRCH) {
-                       DEBUG(2,("pid %s doesn't exist - deleting connections 
%d [%s]\n",
+                       DEBUG(2,("pid %s doesn't exist - deleting connections "
+                                "%d [%s]\n",
                                 procid_str_static(&crec.pid),
                                 crec.cnum, crec.name));
                        tdb_delete(the_tdb, kbuf);

Reply via email to