[Spread-cvs] cvs commit: spread/daemon Changelog groups.c

jonathan at spread.org jonathan at spread.org
Thu Apr 7 23:50:40 EDT 2005


jonathan    05/04/07 23:50:40

  Modified:    daemon   Changelog groups.c
  Log:
  Fix misplaced } in closing "else" statement. Bug was benign because
  of switch/case statement jumps. Most of patch is whitespace/indent adjustment
  once } is in correct location.
  
  Revision  Changes    Path
  1.10      +6 -0      spread/daemon/Changelog
  
  Index: Changelog
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/Changelog,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Changelog	7 Apr 2005 04:04:58 -0000	1.9
  +++ Changelog	8 Apr 2005 03:50:40 -0000	1.10
  @@ -1,3 +1,9 @@
  +Thu Apr  7 23:47:37 2005  Jonathan Stanton  <jonathan at cnds.jhu.edu>
  +
  +	* groups.c (G_handle_reg_memb): Fix misplaced closing } for
  +	else case. Bug introduced in october groups rewrite, but 
  +	effectively benign becaues of switch/case. Fixed by Jonathan.
  +
   Wed Apr  6 23:41:44 2005  Jonathan Stanton  <jonathan at cnds.jhu.edu>
   
   	* protocol.c (Answer_retrans,Send_new_packets,Prot_handle_token): 
  
  
  
  1.22      +101 -101  spread/daemon/groups.c
  
  Index: groups.c
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/groups.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- groups.c	2 Dec 2004 23:52:17 -0000	1.21
  +++ groups.c	8 Apr 2005 03:50:40 -0000	1.22
  @@ -463,115 +463,115 @@
   
                           Gstate              = GGATHER;
                           GlobalStatus.gstate = Gstate;
  -                        break;
  -
  -                case GGATHER:
  -                        Alarmp( SPLOG_FATAL, GROUPS, "G_handle_reg_memb in GGATHER\n");
  -
  -                        break;
  +                }
  +                break;
   
  -                case GGT:
  -                        /*
  -                         * Save reg_memb and reg_memb_id
  -                         * If I received all of my synced set's group messages
  -                         *   For all synced sets for which I have all the Groups messages
  -                         *      Extract group information from Groups messages
  -                         *      Add the synced set to mine
  -                         * Clear all retained Groups messages
  -                         * Check the groups state against the last delivered Trans_memb
  -                         * Check my synced set against Trans_memb
  -                         * If I'm representative of synced set
  -                         *    If Groups bufs are still good (i.e. we didn't change anything)
  -                         *       Stamp Groups messages with current membership id
  -                         *    Else
  -                         *       Remove all Groups bufs
  -                         *       Build groups messages -- 
  -                         *          contains only members local to daemons in SyncedSet
  -                         *    Send groups messages
  -                         * Shift to GGATHER
  -                         */
  -                        Alarmp( SPLOG_INFO, GROUPS, "G_handle_reg_memb in GGT\n");
  -
  -                        Reg_memb    = reg_memb;
  -                        Reg_memb_id = reg_memb_id;
  -
  -                        /* If our messages have all arrived, then we can bring into our
  -                         * synced set anyone who's messages have all arrived.
  -                         * Regardless, we need to dispose of the groups messages. */
  -                        for( grp_mlink = Gathered.next; grp_mlink != NULL; )
  +            case GGATHER:
  +                Alarmp( SPLOG_FATAL, GROUPS, "G_handle_reg_memb in GGATHER\n");
  +            
  +                break;
  +
  +            case GGT:
  +                /*
  +                 * Save reg_memb and reg_memb_id
  +                 * If I received all of my synced set's group messages
  +                 *   For all synced sets for which I have all the Groups messages
  +                 *      Extract group information from Groups messages
  +                 *      Add the synced set to mine
  +                 * Clear all retained Groups messages
  +                 * Check the groups state against the last delivered Trans_memb
  +                 * Check my synced set against Trans_memb
  +                 * If I'm representative of synced set
  +                 *    If Groups bufs are still good (i.e. we didn't change anything)
  +                 *       Stamp Groups messages with current membership id
  +                 *    Else
  +                 *       Remove all Groups bufs
  +                 *       Build groups messages -- 
  +                 *          contains only members local to daemons in SyncedSet
  +                 *    Send groups messages
  +                 * Shift to GGATHER
  +                 */
  +                Alarmp( SPLOG_INFO, GROUPS, "G_handle_reg_memb in GGT\n");
  +
  +                Reg_memb    = reg_memb;
  +                Reg_memb_id = reg_memb_id;
  +
  +                /* If our messages have all arrived, then we can bring into our
  +                 * synced set anyone who's messages have all arrived.
  +                 * Regardless, we need to dispose of the groups messages. */
  +                for( grp_mlink = Gathered.next; grp_mlink != NULL; )
  +                {
  +                    for( mess_link = grp_mlink->first; mess_link != NULL; )
  +                    {
  +                        if( Gathered.complete && grp_mlink->complete )
                           {
  -                                for( mess_link = grp_mlink->first; mess_link != NULL; )
  -                                {
  -                                        if( Gathered.complete && grp_mlink->complete )
  -                                        {
  -                                                ret = G_mess_to_groups( mess_link, &sset );
  -                                                if( ret < 0 )
  -                                                        Alarmp( SPLOG_FATAL, GROUPS, "G_handle_reg_memb:"
  -                                                                " G_mess_to_groups errored %d\n", ret );
  -                                                Groups_bufs_fresh = 0;
  -                                        }
  -                                        grp_mlink->first = mess_link->next;
  -                                        Sess_dispose_message( mess_link );
  -                                        mess_link = grp_mlink->first;
  -                                }
  -                                if( Gathered.complete && grp_mlink->complete )
  -                                        G_add_to_synced_set( &sset );
  -                                Gathered.next = grp_mlink->next;
  -                                dispose( grp_mlink );
  -                                grp_mlink = Gathered.next;
  +                            ret = G_mess_to_groups( mess_link, &sset );
  +                            if( ret < 0 )
  +                                Alarmp( SPLOG_FATAL, GROUPS, "G_handle_reg_memb:"
  +                                        " G_mess_to_groups errored %d\n", ret );
  +                            Groups_bufs_fresh = 0;
                           }
  +                        grp_mlink->first = mess_link->next;
  +                        Sess_dispose_message( mess_link );
  +                        mess_link = grp_mlink->first;
  +                    }
  +                    if( Gathered.complete && grp_mlink->complete )
  +                        G_add_to_synced_set( &sset );
  +                    Gathered.next = grp_mlink->next;
  +                    dispose( grp_mlink );
  +                    grp_mlink = Gathered.next;
  +                }
   
  -                        /* We put off really handling the transitional configuration until now
  -                         * so as to not deliver potentially inconsistent groups messages
  -                         * if we completed the old state exchange.  Now, prepare for the next one.
  -                         */
  -                        giter = sl_getlist( &GroupsList );
  -                        grp = (giter)?(group *)giter->data:NULL;
  -                        for( ; grp != NULL ; grp = nextgroup )
  +                /* We put off really handling the transitional configuration until now
  +                 * so as to not deliver potentially inconsistent groups messages
  +                 * if we completed the old state exchange.  Now, prepare for the next one.
  +                 */
  +                giter = sl_getlist( &GroupsList );
  +                grp = (giter)?(group *)giter->data:NULL;
  +                for( ; grp != NULL ; grp = nextgroup )
  +                {
  +                    nextgroup = sl_next( &GroupsList, &giter );
  +                    group_changed = G_eliminate_partitioned_daemons( grp );
  +                    if( group_changed )
  +                    {
  +                        Groups_bufs_fresh = 0;
  +                        if( grp->num_members == 0 )
                           {
  -                                nextgroup = sl_next( &GroupsList, &giter );
  -                                group_changed = G_eliminate_partitioned_daemons( grp );
  -                                if( group_changed )
  -                                {
  -                                        Groups_bufs_fresh = 0;
  -                                        if( grp->num_members == 0 )
  -                                        {
  -                                                /* discard this empty group */
  -                                                G_remove_group( grp );
  -                                        } else {
  -                                                grp->changed = 1;
  -                                        }
  -                                }
  -                        }
  -                        synced_set_changed = G_check_synced_set( &MySyncedSet, &Trans_memb );
  -                        G_print_synced_set( SPLOG_INFO, &MySyncedSet, "G_handle_reg_memb" );
  -                        /* Since one of the groups bufs holds the synced set... */
  -                        if( synced_set_changed )
  -                                Groups_bufs_fresh = 0;
  -
  -                        Gathered.complete    = 0;
  -                        Num_mess_gathered    = 0;
  -                        Num_daemons_gathered = 0;
  -
  -                        if( Is_synced_set_leader(My.id) ) {
  -                                /*  Stamp own Groups message in buffer with current membership id */
  -                                if( Groups_bufs_fresh ) {
  -                                        G_stamp_groups_bufs();
  -                                } else {
  -                                        G_discard_groups_bufs();
  -                                        G_build_new_groups_bufs();
  -                                        Groups_bufs_fresh = 1;
  -                                }
  -                                ret = G_send_groups_messages();
  -                                Alarmp( SPLOG_INFO, GROUPS, "G_handle_reg_memb: %d GROUPS messages"
  -                                        " sent in GGT\n", ret );
  +                            /* discard this empty group */
  +                            G_remove_group( grp );
  +                        } else {
  +                            grp->changed = 1;
                           }
  +                    }
  +                }
  +                synced_set_changed = G_check_synced_set( &MySyncedSet, &Trans_memb );
  +                G_print_synced_set( SPLOG_INFO, &MySyncedSet, "G_handle_reg_memb" );
  +                /* Since one of the groups bufs holds the synced set... */
  +                if( synced_set_changed )
  +                    Groups_bufs_fresh = 0;
  +
  +                Gathered.complete    = 0;
  +                Num_mess_gathered    = 0;
  +                Num_daemons_gathered = 0;
  +
  +                if( Is_synced_set_leader(My.id) ) {
  +                    /*  Stamp own Groups message in buffer with current membership id */
  +                    if( Groups_bufs_fresh ) {
  +                        G_stamp_groups_bufs();
  +                    } else {
  +                        G_discard_groups_bufs();
  +                        G_build_new_groups_bufs();
  +                        Groups_bufs_fresh = 1;
  +                    }
  +                    ret = G_send_groups_messages();
  +                    Alarmp( SPLOG_INFO, GROUPS, "G_handle_reg_memb: %d GROUPS messages"
  +                            " sent in GGT\n", ret );
  +                }
   
  -                        Gstate = GGATHER;
  -                        GlobalStatus.gstate = Gstate;
  +                Gstate = GGATHER;
  +                GlobalStatus.gstate = Gstate;
   
  -                        break;
  -                }
  +                break;
           }
   }
   
  
  
  



More information about the Spread-cvs mailing list