commit: r368 - trunk/daemon
[email protected] Fri, 17 Nov 2006 13:38:39 -0500
| Newsgroups | gmane.network.spread.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: jonathan Date: 2006-11-17 13:38:38 -0500 (Fri, 17 Nov 2006) New Revision: 368 Modified: trunk/daemon/Changelog trunk/daemon/groups.c Log: Fix race condition that caused group members on different daemons to see different group ids for the same group. Bug analyssi , testing and diagnosis by John Schultz and Ryan Caudy. Patch by Jonathan. Modified: trunk/daemon/Changelog =================================================================== --- trunk/daemon/Changelog 2006-11-15 15:30:32 UTC (rev 367) +++ trunk/daemon/Changelog 2006-11-17 18:38:38 UTC (rev 368) @@ -1,3 +1,11 @@ +Fri Nov 17 13:36:12 2006 Jonathan Stanton <[email protected]> + + * groups.c (G_mess_to_groups,G_build_groups_buf): Fix race + condition bug that caused group members on different daemons + to see different group_id's for the same group. Bug analysis, + testing and diagnosis by John Schultz and Ryan Caudy. Final + patch by Jonathan. + Wed Nov 15 10:27:33 2006 Jonathan Stanton <[email protected]> * sp.c (connect_nointr_timeout): Move wait_timeout Modified: trunk/daemon/groups.c =================================================================== --- trunk/daemon/groups.c 2006-11-15 15:30:32 UTC (rev 367) +++ trunk/daemon/groups.c 2006-11-17 18:38:38 UTC (rev 368) @@ -1871,6 +1871,7 @@ * changed in any respect by this membership) or this ID can be * discarded. This is here so that daemons that don't know about * the group at all can get the correct ID in the unchanged case.] + * changed flag (byte) * number of daemons for this group (in this message) (int16u) * For each daemon: * daemon proc id (int32) @@ -1916,7 +1917,7 @@ /* To have information about this group, we need to be able to fit * its name, ID, and the number of daemons it has in this message. */ - size_needed = MAX_GROUP_NAME + sizeof(group_id) + sizeof(int16u) + Message_get_data_header_size(); + size_needed = MAX_GROUP_NAME + sizeof(group_id) + sizeof(byte) + sizeof(int16u) + Message_get_data_header_size(); if( size_needed > GROUPS_BUF_SIZE - num_bytes ) break; memcpy( &buf[num_bytes], grp->name, MAX_GROUP_NAME ); @@ -1925,6 +1926,9 @@ memcpy( &buf[num_bytes], &grp->grp_id, sizeof(group_id) ); num_bytes += sizeof(group_id); + memcpy( &buf[num_bytes], &grp->changed, sizeof(byte) ); + num_bytes += sizeof(byte); + num_dmns_ptr = &buf[num_bytes]; num_bytes += sizeof(int16u); num_dmns = 0; @@ -2081,6 +2085,7 @@ int i,j; char ip_string[16]; stdit it; + char sent_group_changed; total_bytes = 0; msg = mess_link->mess; @@ -2158,8 +2163,14 @@ Num_groups++; GlobalStatus.num_groups = Num_groups; - } + } num_bytes += sizeof(group_id); + /* Get the changed flag for sent group and set local group changed flag if sent group was marked changed */ + memcpy( &sent_group_changed, &Temp_buf[num_bytes], sizeof(byte) ); + num_bytes += sizeof(byte); + + if (sent_group_changed) + grp->changed = 1; memcpy( &num_dmns, &Temp_buf[num_bytes], sizeof(int16u) ); num_bytes += sizeof(int16u);