[Spread-cvs] commit: r627 - trunk/daemon

jschultz at spread.org jschultz at spread.org
Mon Nov 18 14:54:19 EST 2013


Author: jschultz
Date: 2013-11-18 14:54:19 -0500 (Mon, 18 Nov 2013)
New Revision: 627

Modified:
   trunk/daemon/arch.h
   trunk/daemon/membership.c
   trunk/daemon/network.c
   trunk/daemon/protocol.c
   trunk/daemon/spread.c
Log:
svn merge -r599:625 branches/spread_4_2_debug trunk


Modified: trunk/daemon/arch.h
===================================================================
--- trunk/daemon/arch.h	2013-11-18 19:44:27 UTC (rev 626)
+++ trunk/daemon/arch.h	2013-11-18 19:54:19 UTC (rev 627)
@@ -208,9 +208,11 @@
 
 /* Pick which rand version to use */
 #ifdef HAVE_LRAND48
-#define get_rand lrand48
+#  define get_rand lrand48
+#  define set_rand srand48
 #else
-#define get_rand rand
+#  define get_rand rand
+#  define set_rand srand
 #endif
 
 /* Useful CPP macros to make strings from #defines */  

Modified: trunk/daemon/membership.c
===================================================================
--- trunk/daemon/membership.c	2013-11-18 19:44:27 UTC (rev 626)
+++ trunk/daemon/membership.c	2013-11-18 19:54:19 UTC (rev 627)
@@ -691,36 +691,34 @@
     switch( State )
     {
 	case OP:
-	    Alarm( MEMB, "Handle_form1 in OP\n");
-		if( Conf_leader( &Membership ) == My.id ) /* do nothing */;
-		else Fill_form1( scat );
-		break;
+	        if( Conf_leader( &Membership ) == My.id ) { Alarmp( SPLOG_INFO, MEMB, "Handle_form1 in OP (leader swallow)\n");
+	        } else { Alarmp( SPLOG_INFO, MEMB, "Handle_form1 in OP\n"); Fill_form1( scat ); }
+	        break;
 
 	case SEG:
-	    Alarm( MEMB, "Handle_form1 in SEG\n");
+	        Alarmp( SPLOG_INFO, MEMB, "Handle_form1 in SEG (swallow)\n");
 		/* swallow this token */
 		break;
 
 	case REPRESENTED:
-	    Alarm( MEMB, "Handle_form1 in REPRESENTED\n");
+	        Alarmp( SPLOG_INFO, MEMB, "Handle_form1 in REPRESENTED\n");
 		Fill_form1( scat );
 		break;
 
 	case GATHER:
-	    Alarm( MEMB, "Handle_form1 in GATHER\n");
+	        Alarmp( SPLOG_INFO, MEMB, "Handle_form1 in GATHER\n");
 		Fill_form1( scat );
 		break;
 
 	case FORM:
-	    Alarm( MEMB, "Handle_form1 in FORM\n");
+	        Alarmp( SPLOG_INFO, MEMB, "Handle_form1 in FORM (swallow)\n");
 		/* swallow this token */
 		break;
 
 	case EVS:
-	    Alarm( MEMB, "Handle_form1 in EVS\n");
+	        Alarmp( SPLOG_INFO, MEMB, "Handle_form1 in EVS (swallow)\n");
 		/* swallow this token */
 		break;
-
     }
 }
 
@@ -729,22 +727,22 @@
     switch( State )
     {
 	case OP:
-		Alarm( MEMB, "Handle_form2 in OP\n");
+		Alarm( MEMB, "Handle_form2 in OP (swallow)\n");
 		/* swallow this token */
 		break;
 
 	case SEG:
-		Alarm( MEMB, "Handle_form2 in SEG\n");
+		Alarm( MEMB, "Handle_form2 in SEG (swallow)\n");
 		/* swallow this token */
 		break;
 
 	case REPRESENTED:
-		Alarm( MEMB, "Handle_form2 in REPRESENTED\n");
+		Alarm( MEMB, "Handle_form2 in REPRESENTED (swallow)\n");
 		/* swallow this token */
 		break;
 
 	case GATHER:
-		Alarm( MEMB, "Handle_form2 in GATHER\n");
+		Alarm( MEMB, "Handle_form2 in GATHER (swallow)\n");
 		/* swallow this token */
 		break;
 
@@ -754,7 +752,7 @@
 		break;
 
 	case EVS:
-		Alarm( MEMB, "Handle_form2 in EVS\n");
+		Alarm( MEMB, "Handle_form2 in EVS (swallow)\n");
 		/* swallow this token */
 		break;
     }
@@ -792,7 +790,6 @@
 	case SEG:
 	case REPRESENTED:
 	    Alarm( EXIT, "Memb_token_loss: bug !!! state is %d\n",State);
-
 	    break;
 
 	case GATHER:
@@ -872,9 +869,10 @@
 
     for( i=0; i < Conf_num_segments( Cn ); i++ )
 	Membership.segments[i].num_procs = 0;
+
     Conf_append_id_to_seg(&Membership.segments[My.seg_index], My.id);
 
-    Alarm( MEMB, "Memb_token_loss: I lost my token, state is %d\n",State);
+    Alarmp( SPLOG_WARNING, MEMB, "Memb_token_loss: ############### I lost my token, state was %d\n\n", State);
     Shift_to_seg();
 }
 
@@ -1392,6 +1390,8 @@
 	rg_info->aru		= Aru;
 	rg_info->highest_seq	= Highest_seq;
 
+	/*Alarmp(SPLOG_INFO, MEMB, "Create_form1: putting Aru = %d and Highest_Seq = %d on rg_info form1 token\n", Aru, Highest_seq);*/
+
 	/* update holes */
 	rg_info->num_holes	= 0;
 	for( index = My_aru+1; index <= Highest_seq; index++ )
@@ -1498,7 +1498,11 @@
 	int             cur_num_members;
         int             num_to_copy;
         members_info    valid_members;
-	
+
+	if ( Alarm_get_priority() >= SPLOG_INFO && ( Alarm_get_types() & MEMB ) != 0 ) {
+	        Memb_print_form_token( scat );
+	}
+
 	num_bytes  = 0;
 
 	form_token = (token_header *)scat->elements[0].buf;
@@ -1674,6 +1678,8 @@
 	new_rg_info->aru	 = Aru;
 	new_rg_info->highest_seq = Highest_seq;
 
+	/*Alarmp(SPLOG_INFO, MEMB, "Fill_form1: Putting Aru = %d and Highest_seq = %d on new_rg_info of form1 token\n", Aru, Highest_seq);*/
+
 	if( my_rg_info == NULL )
 	{
 
@@ -1743,11 +1749,17 @@
 	
 	    members_info temp_set;
 
-	    if( my_rg_info->aru         > Aru )
+	    if( my_rg_info->aru         > Aru ) {
 		new_rg_info->aru 	= my_rg_info->aru;
+		/*Alarmp( SPLOG_INFO, MEMB, "my_rg_info->aru (%d) > Aru (%d) -> setting new_rg_info->aru to my_rg_info\n", 
+		  my_rg_info->aru, Aru );*/
+	    }
 
-	    if( my_rg_info->highest_seq > Highest_seq )
+	    if( my_rg_info->highest_seq > Highest_seq ) {
 		new_rg_info->highest_seq= my_rg_info->highest_seq;
+		/*Alarmp( SPLOG_INFO, MEMB, "my_rg_info->highest_seq (%d) > Highest_seq (%d) -> setting new_rg_info->highest_seq to my_rg_info\n", 
+		  my_rg_info->highest_seq, Highest_seq );*/
+	    }
 
 	    for( i=0; i < my_rg_info->num_holes; i++ )
 	    {
@@ -1755,9 +1767,7 @@
 		if( ! Packets[pack_entry].exist )
 		{
 			*new_holes_procs_ptr	= *my_holes_procs_ptr;
-			Alarm( MEMB ,
-		"INSERT HOLE 3 IS %d My_aru is %d, Highest_seq is %d\n",
-				*new_holes_procs_ptr,My_aru, Highest_seq);
+			Alarmp( SPLOG_INFO, MEMB, "INSERT HOLE 3 IS %d, My_aru is %d, Highest_seq is %d\n", *new_holes_procs_ptr, My_aru, Highest_seq );
 			new_holes_procs_ptr++;
 			num_bytes	+= sizeof(int32);
 			new_rg_info->num_holes++;
@@ -1838,16 +1848,14 @@
 	if( m_info->num_pending > 0 )
 	{
 		/* send to next member in pending list */
-		Net_ucast_token( m_info->members[m_info->num_members], 
-			&send_scat );
-		Net_ucast_token( m_info->members[m_info->num_members], 
-			&send_scat );
+		Net_ucast_token( m_info->members[m_info->num_members], &send_scat );
+		Net_ucast_token( m_info->members[m_info->num_members], &send_scat );
+
 	}else if( r_info->rep_index < r_info->num_reps){
 		/* send to next rep */
-		Net_ucast_token( r_info->reps[r_info->rep_index].proc_id, 
-			&send_scat );
-		Net_ucast_token( r_info->reps[r_info->rep_index].proc_id, 
-			&send_scat );
+		Net_ucast_token( r_info->reps[r_info->rep_index].proc_id, &send_scat );
+		Net_ucast_token( r_info->reps[r_info->rep_index].proc_id, &send_scat );
+
 	}else{
 		/* prepare form2 token */
 		Sort_members( m_info );
@@ -1892,6 +1900,10 @@
 	int		ret;
 	int		i;
         int32           memb_time = 0;
+
+	if ( Alarm_get_priority() >= SPLOG_INFO && ( Alarm_get_types() & MEMB ) != 0 ) {
+	        Memb_print_form_token( scat );
+	}
 	
 	num_bytes  = 0;
 
@@ -1985,6 +1997,9 @@
                       *num_rings, num_bytes, Membership_id.proc_id, Membership_id.time); 
         }
 
+	/*Alarmp( SPLOG_INFO, MEMB, "Read_form2: updating Highest_seq %d -> %d; Aru %d -> %d\n", 
+	  Highest_seq, my_rg_info->highest_seq, Aru, my_rg_info->aru );*/
+
 	Highest_seq = my_rg_info->highest_seq;
 	Aru	    = my_rg_info->aru;
         /* Note: this call to Discard_packets handles delivery of all the messages
@@ -2049,11 +2064,12 @@
 
 		form_token->type = 0;
 		form_token->seq = 0;
-		form_token->aru = Last_seq;
+		form_token->aru = Last_seq;  /* TODO: is this right? if so, shouldn't we set Last_token this way too below? */
 		form_token->flow_control = 0;
 		form_token->rtr_len = 0;
 
 		Net_send_token( &send_scat );
+		Net_send_token( &send_scat );
 		Token_rounds = 1;
 	}
 	Token_alive = 1;
@@ -2225,13 +2241,18 @@
 	int	pack_entry;
 	int	i;
 
+	/*Alarmp( SPLOG_INFO, MEMB, "Backoff_membership entered: Last_discarded = %d; Highest_seq = %d; Aru = %d; My_aru = %d\n", 
+	  Last_discarded, Highest_seq, Aru, My_aru );*/
+
 	pack_entry=-1;
 	for( i=Last_discarded+1; i <= Highest_seq; i++ )
 	{
 		/* clear dummy messages */
 		pack_entry = i & PACKET_MASK;
-		if( Packets[pack_entry].exist == 3 )
+		if( Packets[pack_entry].exist == 3 ) {
+		        Alarmp( SPLOG_INFO, MEMB, "Backoff_membership: reverting dummy hole to true hole for packet %d\n", pack_entry );
 			Packets[pack_entry].exist = 0;
+		}
 	}
 
 	/* return Aru and My_aru */
@@ -2244,6 +2265,9 @@
 		if( !Packets[pack_entry].exist ) break;
 		My_aru++;
 	}
+
+	/*Alarmp( SPLOG_INFO, MEMB, "Backoff_membership leaving: Last_discarded = %d; Highest_seq = %d; Aru = %d; My_aru = %d\n", 
+	  Last_discarded, Highest_seq, Aru, My_aru );*/
 }
 
 void	Memb_commit()

Modified: trunk/daemon/network.c
===================================================================
--- trunk/daemon/network.c	2013-11-18 19:44:27 UTC (rev 626)
+++ trunk/daemon/network.c	2013-11-18 19:54:19 UTC (rev 627)
@@ -643,6 +643,12 @@
         token_ptr->conf_hash = Cn->hash_code;
 	token_ptr->transmiter_id = My.id;
 
+	Alarmp( SPLOG_INFO, NETWORK, 
+		"Net_send_token: type = 0x%08X; transmitter_id = 0x%08X; seq = %d; proc_id = 0x%08X\n"
+		"\taru = %d; aru_last_id = 0x%08X; Token_address = 0x%08X\n", 
+		token_ptr->type, token_ptr->transmiter_id, token_ptr->seq, token_ptr->proc_id, 
+		token_ptr->aru, token_ptr->aru_last_id, Token_address );
+
         if ( token_ptr->rtr_len > (MAX_PACKET_SIZE - sizeof(token_header) ) )
         {
             if ( Is_form( token_ptr->type ) )

Modified: trunk/daemon/protocol.c
===================================================================
--- trunk/daemon/protocol.c	2013-11-18 19:44:27 UTC (rev 626)
+++ trunk/daemon/protocol.c	2013-11-18 19:54:19 UTC (rev 627)
@@ -73,6 +73,8 @@
 /* Used to indicate a need to reload configuration at end of current membership */
 static  bool            Prot_Need_Conf_Reload  = FALSE;
 
+static  bool            Just_Installed = FALSE;  /* tracks if we just installed a reg memb due to last token we sent */
+
 /* ### Pack: 1 line */
 static	packet_info	Buffered_packets[ARCH_SCATTER_SIZE];
 
@@ -455,27 +457,28 @@
 	r2 = get_rand() % (r1+3 );
 	if ( r2 == 0 ) return; */
 
-        Alarm( DEBUG, "Received Token\n");
 	/* check if it is a regular token */
 	if( Is_form( Token->type ) )
 	{
-                Alarm(PROTOCOL, "it is a Form Token.\n");
+	        Alarmp( SPLOG_INFO, PROTOCOL, "Prot_handle_token: it is a Form Token.\n" );
                 Memb_handle_token( &New_token );
-		return;
+		goto END;
 	}
 
 	/* The Veto property for tokens - swallow this token */
 	if( ! Memb_token_alive() ) {
-                Alarm(PROTOCOL, "Prot_handle_token: Veto Property. Memb not alive.\n");
-		return;
+	        Alarmp( SPLOG_INFO, PROTOCOL, "Prot_handle_token: Veto Property. Memb not alive.\n" );
+		goto END;
         }
 
+        Alarmp( SPLOG_INFO, PROTOCOL, 
+	       "Prot_handle_token: type = 0x%08X; transmitter = 0x%08X; seq = %d; proc_id = 0x%08X; aru = %d; aru_last_id = 0x%08X;\n", 
+	       Token->type, Token->transmiter_id, Token->seq, Token->proc_id, Token->aru, Token->aru_last_id );
+
 	if( ret != sizeof(token_header) + Token->rtr_len )
 	{
-		Alarm( PRINT, 
-		    "Prot_handle_token: recv token len is %d, should be %d\n",
-		    ret,sizeof(token_header) + Token->rtr_len );
-		return;
+	        Alarmp( SPLOG_WARNING, PROTOCOL, "Prot_handle_token: recv token len is %d, should be %d\n", ret, sizeof(token_header) + Token->rtr_len );
+		goto END;
 	}
 
 	if( !Same_endian( Token->type ) ) 
@@ -484,21 +487,27 @@
         /* Deal with wrapping seq values (2^32) by triggering a membership by dropping the token */
         if( (Memb_state() != EVS ) && (Token->seq > MAX_WRAP_SEQUENCE_VALUE ) )
         {
-            Alarm( PRINT, "Prot_handle_token: Token Sequence number (%ld) approaching 2^31 so trigger membership to reset it.\n", Token->seq);
+	    Alarmp( SPLOG_WARNING, PROTOCOL, "Prot_handle_token: seq (%ld) about to rollover; trigger membership to reset it.\n", Token->seq );
             /* return swallows token and will break ring and trigger membership */
-            return;
+            goto END;
         }
 
 	if( Conf_leader( Memb_active_ptr() ) == My.id )
 	{
 		if( Get_arq(Token->type) != Get_arq(Last_token->type) )
 		{
-		    Alarm( PROTOCOL, 
-			"Prot_handle_token: leader swallowing token %d %d %d\n", 
-			 Get_arq(Token->type),Get_retrans(Token->type),Get_arq(Last_token->type) );
+		    Alarmp( SPLOG_INFO, PROTOCOL, 
+			"Prot_handle_token: leader swallowing token; type = %d; retrans = %d; arq = %d\n", 
+			 Get_arq(Token->type), Get_retrans(Token->type), Get_arq(Last_token->type) );
 		    /* received double token - swallow it */
-		    return; 
+		    goto END; 
+
+		} else if (Memb_state() == OP && Just_Installed) {
+		    Just_Installed  = FALSE;
+		    Last_token->aru = 0;      /* wipe out EVS aru on last token due to transitioning from EVS -> OP */
+		    /* NOTE: we do this now rather than just when we installed to allow proper token retransmissions */
 		}
+
 	}else{
 		if( Get_arq(Token->type) == Get_arq(Last_token->type) )
 		{
@@ -516,20 +525,28 @@
 			    "Prot_handle_token: not leader, swallow same token %d %d\n",
 	   			Get_arq(Token->type), Get_retrans(Token->type) );
 		    }
-		    return;
+		    goto END;
 
 		} else if ( Get_arq(Token->type) != ( ( Get_arq( Last_token->type ) + 1 ) % 0x10 ) ) {
 		  Alarm( PROTOCOL, 
 			 "Prot_handle_token: not leader, swallowing very outdated token: ARQ(%d) RETRANS(%d) vs. Last ARQ(%d)\n",
 			 Get_arq(Token->type), Get_retrans(Token->type), Get_arq(Last_token->type) );
-		  return;
+		  goto END;
 
 		} else {
+
+			if (Memb_state() == OP && Just_Installed) {
+			  Just_Installed  = FALSE;
+			  Last_token->aru = 0;      /* wipe out EVS aru on last token due to transitioning from EVS -> OP */
+			  /* NOTE: we do this now rather than just when we installed to allow proper token retransmissions */
+			}
+
                         if ( Get_retrans(Token->type) > 0 ) {
                                 GlobalStatus.token_hurry++;
                         }
                 }
 	}
+
 	if( Highest_seq < Token->seq ) Highest_seq = Token->seq;
 		
 	/* Handle retransmissions */
@@ -600,7 +617,7 @@
 	/* Calculating Token->aru and Set_aru */
 	if( ( Token->aru == Set_aru    ) ||
             ( Token->aru_last_id == My.id ) ||
-	    ( Token->aru == Token->seq ) )
+	    ( Token->aru == Token->seq && Memb_state() != EVS ) )  /* NOTE: Token->seq is meaningless in EVS */
 	{
 		Token->aru = My_aru;
                 Token->aru_last_id = My.id;
@@ -651,12 +668,14 @@
 
 	E_queue( Memb_token_loss, 0, NULL, Token_timeout );
 
-
 	/* calculating Aru */
-	if( Token->aru > Last_token->aru )
+	if( Token->aru > Last_token->aru ) {
+	        /*Alarmp( SPLOG_INFO, PROTOCOL, "Prot_handle_token: updating Aru from Last_token; Aru %d -> %d\n", Aru, Last_token->aru );*/
 		Aru = Last_token->aru;
-	else
+	} else {
+	        /*Alarmp( SPLOG_INFO, PROTOCOL, "Prot_handle_token: updating Aru from Token; Aru %d -> %d\n", Aru, Token->aru );*/
 		Aru = Token->aru;
+	}
 	if( Highest_seq == Aru ) Token_counter++;
 	else Token_counter = 0;
 
@@ -700,6 +719,9 @@
 	GlobalStatus.highest_seq = Highest_seq;
 	GlobalStatus.aru = Aru;
 	GlobalStatus.token_rounds = Token_rounds;
+
+ END:
+	/*Alarmp( SPLOG_INFO, PROTOCOL, "Prot_handle_token: LEAVING!\n" )*/;
 }
 
 /* Provide boolean result of whether the membership system needs to initiate a configuration reload
@@ -845,33 +867,28 @@
                         old_ptr += sizeof(int32);
                         pack_entry = *req_seq & PACKET_MASK;
                         if( *req_seq < Aru ) 
-                                Alarm( EXIT, 
-                "Answer_retrans: retrans of %d requested while Aru is %d\n",
-                                *req_seq,Aru );
+                                Alarm( EXIT, "Answer_retrans: retrans of %d requested while Aru is %d\n", *req_seq, Aru );
 
                         if( Packets[pack_entry].exist )
                         {
                                 pack_ptr = Packets[pack_entry].head;
-                                Send_pack.elements[0].buf = 
-                                    (char *)Packets[pack_entry].head;
-                                Send_pack.elements[1].buf = 
-                                    (char *)Packets[pack_entry].body;
-                                Send_pack.elements[1].len = 
-                                    pack_ptr->data_len; 
+                                Send_pack.elements[0].buf = (char *)Packets[pack_entry].head;
+                                Send_pack.elements[1].buf = (char *)Packets[pack_entry].body;
+                                Send_pack.elements[1].len = pack_ptr->data_len; 
 
                                 if( ring_rtr_ptr->proc_id != -1 )
                                 {
                                     ret = Net_ucast ( ring_rtr_ptr->proc_id, &Send_pack );
 				    GlobalStatus.u_retrans++;
 
-                                    Alarm( PROTOCOL, 
-        "Answer_retrans: retransmit to proc %d\n", ring_rtr_ptr->proc_id );
+                                    Alarmp( SPLOG_INFO, PROTOCOL, "Answer_retrans: retransmit %d to proc 0x%08X\n", *req_seq, ring_rtr_ptr->proc_id );
+
                                 }else if( ring_rtr_ptr->seg_index != -1 ) {
                                     ret = Net_scast ( ring_rtr_ptr->seg_index, &Send_pack );
 				    GlobalStatus.s_retrans++;
 
-                                    Alarm( PROTOCOL, 
-        "Answer_retrans: retransmit to seg %d\n", ring_rtr_ptr->seg_index );
+                                    Alarmp( SPLOG_INFO, PROTOCOL, "Answer_retrans: retransmit %d to seg 0x%08X\n", *req_seq, ring_rtr_ptr->seg_index );
+
                                 }else{
 #if 1
                                     ret = Net_queue_bcast ( &Send_pack );
@@ -880,8 +897,7 @@
 #endif
 				    if( ret > 0 ) GlobalStatus.b_retrans++;
 
-                                    Alarm( PROTOCOL, 
-        "Answer_retrans: retransmit to all\n");
+                                    Alarmp( SPLOG_INFO, PROTOCOL, "Answer_retrans: retransmit %d to all\n", *req_seq);
                                 }
 				if( ret > 0 )
 				{
@@ -904,7 +920,7 @@
                     old_ptr += bytes_to_copy;
                     new_ptr += bytes_to_copy;
 
-                    Alarm( PROTOCOL, "Prot_handle_token: Coping foreign rtr\n");
+                    Alarmp( SPLOG_INFO, PROTOCOL, "Prot_handle_token: Coping foreign rtr\n");
                 }
             }
         }
@@ -1216,8 +1232,7 @@
 		found_hole = 1;
 		Alarm( PROTOCOL, "Discard_packets: Found a Hole in %d \n",i);
 
-	    }else if( (!found_hole) || 
-   (Conf_id_in_conf( &Commit_membership, Packets[pack_entry].head->proc_id ) != -1) ){
+	    }else if( !found_hole || Conf_id_in_conf( &Commit_membership, Packets[pack_entry].head->proc_id ) != -1 ){
 		/* should deliver packet or dispose the body if it was delivered already */
 		if( Packets[pack_entry].exist == 1 ){
 			 Deliver_packet( pack_entry, 0 );
@@ -1268,6 +1283,8 @@
 
 	/* calculate and deliver regular membership */
 	Memb_regular();
+	Just_Installed = TRUE;
+
 	Log_membership();
 	reg_memb_id = Memb_id();
 	Sess_deliver_reg_memb( Reg_membership, reg_memb_id );
@@ -1279,7 +1296,8 @@
         if( Conf_in_reload_singleton_state() ) {
                 /* GOP state equals value 1, but is private declaration in groups.c */
                 if ( (GlobalStatus.gstate != 1 ) || ( Conf_num_procs( &Reg_membership ) != 1 ) ) {
-                        Alarmp( SPLOG_FATAL, MEMB, "Discard_packets: Failed to reload configuration - gstate: %d and num_procs in membership: %d\n", GlobalStatus.gstate, Conf_num_procs( &Reg_membership) );
+                        Alarmp( SPLOG_FATAL, PROTOCOL, "Discard_packets: Failed to reload configuration - gstate: %d and num_procs in membership: %d\n", 
+				GlobalStatus.gstate, Conf_num_procs( &Reg_membership) );
                 }
                 Net_clear_partition();
                 E_queue( Memb_lookup_new_members, 0, NULL, Zero_timeout);
@@ -1287,17 +1305,15 @@
         }
 
 	/* set variables for next membership */
-        if ( Conf_debug_initial_sequence() ) {
-            Last_token->aru	 = INITIAL_SEQUENCE_NEAR_WRAP;
+        if ( Conf_debug_initial_sequence() ) {  /* TODO: get rid of this debug stuff */
             Highest_seq 	 = INITIAL_SEQUENCE_NEAR_WRAP;
             Highest_fifo_seq     = INITIAL_SEQUENCE_NEAR_WRAP;
             My_aru	    	 = INITIAL_SEQUENCE_NEAR_WRAP;
             Aru		         = INITIAL_SEQUENCE_NEAR_WRAP;
-            Set_aru		 = INITIAL_SEQUENCE_NEAR_WRAP -1;
+            Set_aru		 = INITIAL_SEQUENCE_NEAR_WRAP - 1;
             Last_discarded	 = INITIAL_SEQUENCE_NEAR_WRAP;
             Last_delivered	 = INITIAL_SEQUENCE_NEAR_WRAP;
         } else {
-            Last_token->aru	 = 0;
             Highest_seq 	 = 0;
             Highest_fifo_seq     = 0;
             My_aru	    	 = 0;
@@ -1307,6 +1323,8 @@
             Last_delivered	 = 0;
         }
 
+	/*Alarmp( SPLOG_INFO, PROTOCOL, "Discard_packets: Updated Aru to %d for next membership\n", Aru );*/
+
 	GlobalStatus.my_aru	 = My_aru;
 	Token_counter 	= 0;
 

Modified: trunk/daemon/spread.c
===================================================================
--- trunk/daemon/spread.c	2013-11-18 19:44:27 UTC (rev 626)
+++ trunk/daemon/spread.c	2013-11-18 19:54:19 UTC (rev 627)
@@ -32,10 +32,8 @@
  *
  */
 
+#include <string.h>
 
-
-
-#include <string.h>
 #include "arch.h"
 #include "spread_params.h"
 #include "session.h"
@@ -43,22 +41,22 @@
 #include "spu_events.h"
 #include "status.h"
 #include "log.h"
+#include "sess_body.h"
 #include "spu_alarm.h"
 
+#include "stdutil/stdutil.h"
+
 #ifndef ARCH_PC_WIN95
-#include <grp.h>
-#include <pwd.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#  include <grp.h>
+#  include <pwd.h>
+#  include <unistd.h>
+#  include <sys/types.h>
+#  include <sys/stat.h>
 #endif
 
 #ifdef	ARCH_PC_WIN95
-
-#include	<winsock.h>
-
+#  include	<winsock.h>
 WSADATA		WSAData;
-
 #endif	/* ARCH_PC_WIN95 */
 
 static	char		*My_name;
@@ -162,7 +160,13 @@
 	Conf_init( Config_file, My_name );
 
 	E_init();
+	
+	{
+	  sp_time t = E_get_time();
 
+	  set_rand( (int) stdhcode_oaat( &t, sizeof( t ) ) ^ (int) stdhcode_oaat( &My.id, sizeof( My.id ) ) );
+	}
+
 #ifndef	ARCH_PC_WIN95
         /* Verify that unix socket dir is safe if runing as root user */
         if (geteuid() == (uid_t) 0) {




More information about the Spread-cvs mailing list