Author: jonathan
Date: 2006-11-14 00:22:24 -0500 (Tue, 14 Nov 2006)
New Revision: 361
Modified:
branches/branch_3_17/daemon/Changelog
branches/branch_3_17/daemon/arch.h
branches/branch_3_17/daemon/groups.c
Log:
Fix for bug where group id's are slightly different between processes who
should be in same view. This is done by propagating the grp->changed flag
in groups messages. Bug fix design and patch by John Schultz and Yair Amir.
Modified: branches/branch_3_17/daemon/Changelog
===================================================================
--- branches/branch_3_17/daemon/Changelog 2006-11-14 00:31:16 UTC (rev 360)
+++ branches/branch_3_17/daemon/Changelog 2006-11-14 05:22:24 UTC (rev 361)
@@ -1,3 +1,10 @@
+Tue Nov 14 00:20:02 2006 Jonathan Stanton <[email protected]>
+
+ * groups.c (G_compute_and_notify,G_mess_to_group): Propagate
+ grp->changed flag in groups messages so all daemons have
+ same decision about whether a group is in changed state. Bug fix
+ design and original patch by John Schultz and Yair Amir.
+
Wed Apr 6 23:41:44 2005 Jonathan Stanton <[email protected]>
* protocol.c (Answer_retrans,Send_new_packets,Prot_handle_token):
Modified: branches/branch_3_17/daemon/arch.h
===================================================================
--- branches/branch_3_17/daemon/arch.h 2006-11-14 00:31:16 UTC (rev 360)
+++ branches/branch_3_17/daemon/arch.h 2006-11-14 05:22:24 UTC (rev 361)
@@ -94,7 +94,7 @@
#define sock_set_errno(a) (errno = (a))
#ifndef byte
-#define byte u_int_8
+#define byte u_int8_t
#endif
#ifndef int16
@@ -155,6 +155,10 @@
#define EAGAIN WSAEWOULDBLOCK
#define EINPROGRESS WSAEINPROGRESS
+#ifndef byte
+#define byte unsigned char
+#endif
+
#ifndef int16
#define int16 short
#endif
Modified: branches/branch_3_17/daemon/groups.c
===================================================================
--- branches/branch_3_17/daemon/groups.c 2006-11-14 00:31:16 UTC (rev 360)
+++ branches/branch_3_17/daemon/groups.c 2006-11-14 05:22:24 UTC (rev 361)
@@ -1566,7 +1566,7 @@
strcpy( new_grp->name, this_group->name );
new_grp->grp_id = this_group->grp_id;
- new_grp->changed = 0;
+ new_grp->changed = this_group->changed;;
new_grp->num_members = 0;
sl_init( &new_grp->MembersList );
sl_set_compare( &new_grp->MembersList,
@@ -1587,8 +1587,9 @@
for( i=0 ; i < num_exist; i++ )
{
group *currentgroup;
- currentgroup =
- (group *)sl_getlist(indices[i]->groups)->data;
+ currentgroup =(group *)sl_getlist(indices[i]->groups)->data;
+ if (currentgroup->changed) changed = 1;
+
if( G_id_is_equal( orig_grp->grp_id, currentgroup->grp_id ) )
{
struct skiplistnode *iter;
@@ -1950,7 +1951,7 @@
{
if( grp->num_local == 0 ) continue;
- size_for_this_group = MAX_GROUP_NAME + sizeof(group_id) + sizeof(int16) +
+ size_for_this_group = MAX_GROUP_NAME + sizeof(group_id) + sizeof(int16) + sizeof(byte) +
(grp->num_local * MAX_GROUP_NAME) + Message_get_data_header_size();
/* This requires that the number of local group members be limited. */
if( size_for_this_group > GROUPS_BUF_SIZE - num_bytes ) break;
@@ -1962,6 +1963,9 @@
num_bytes += sizeof( group_id );
memcpy( gid_ptr, &grp->grp_id, sizeof(group_id) );
+ buf[num_bytes] = (byte) grp->changed;
+ num_bytes += sizeof( byte );
+
num_memb_ptr = &buf[num_bytes];
num_bytes += sizeof( int16 );
num_memb = 0;
@@ -2048,6 +2052,9 @@
num_bytes += sizeof( group_id );
memcpy( &grp->grp_id, gid_ptr, sizeof(group_id) );
+ grp->changed = Temp_buf[num_bytes];
+ num_bytes += sizeof( byte );
+
num_memb_ptr = &Temp_buf[num_bytes];
num_bytes += sizeof( int16 );
memcpy( &num_memb, num_memb_ptr, sizeof( int16 ) );
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.