[Spread-cvs] commit: r620 - branches/spread_4_2_debug/daemon
jschultz at spread.org
jschultz at spread.org
Wed Nov 13 19:17:25 EST 2013
Author: jschultz
Date: 2013-11-13 19:17:24 -0500 (Wed, 13 Nov 2013)
New Revision: 620
Modified:
branches/spread_4_2_debug/daemon/arch.h
branches/spread_4_2_debug/daemon/membership.c
branches/spread_4_2_debug/daemon/net_types.h
branches/spread_4_2_debug/daemon/protocol.c
branches/spread_4_2_debug/daemon/protocol.h
branches/spread_4_2_debug/daemon/spread.c
Log:
Cleaning up branch -- needs more review
Modified: branches/spread_4_2_debug/daemon/arch.h
===================================================================
--- branches/spread_4_2_debug/daemon/arch.h 2013-11-12 17:34:53 UTC (rev 619)
+++ branches/spread_4_2_debug/daemon/arch.h 2013-11-14 00:17:24 UTC (rev 620)
@@ -204,9 +204,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: branches/spread_4_2_debug/daemon/membership.c
===================================================================
--- branches/spread_4_2_debug/daemon/membership.c 2013-11-12 17:34:53 UTC (rev 619)
+++ branches/spread_4_2_debug/daemon/membership.c 2013-11-14 00:17:24 UTC (rev 620)
@@ -836,7 +836,6 @@
Shift_to_seg();
Token_alive = 0;
- Just_Installed = FALSE;
E_dequeue( Memb_token_loss, 0, NULL );
E_dequeue( Send_join, 0, NULL );
E_dequeue( Form_or_fail, 0, NULL );
@@ -1473,9 +1472,11 @@
int cur_num_members;
int num_to_copy;
members_info valid_members;
-
- Memb_print_form_token(scat);
+ if ( ( Alarm_get_types() & MEMB ) != 0 ) {
+ Memb_print_form_token(scat);
+ }
+
num_bytes = 0;
form_token = (token_header *)scat->elements[0].buf;
@@ -1872,7 +1873,9 @@
int i;
int32 memb_time = 0;
- Memb_print_form_token(scat);
+ if ( ( Alarm_get_types() & MEMB ) != 0 ) {
+ Memb_print_form_token(scat);
+ }
num_bytes = 0;
@@ -2030,9 +2033,9 @@
/* build first regular token */
send_scat.num_elements = 1;
- form_token->type = 0; /*EVS_TYPE;*/
+ 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;
@@ -2043,7 +2046,7 @@
Token_alive = 1;
E_queue( Memb_token_loss, 0, NULL, Token_timeout );
- Last_token->type = 0; /*EVS_TYPE;*/
+ Last_token->type = 0;
Last_token->seq = 0;
Last_token->aru = 0;
Modified: branches/spread_4_2_debug/daemon/net_types.h
===================================================================
--- branches/spread_4_2_debug/daemon/net_types.h 2013-11-12 17:34:53 UTC (rev 619)
+++ branches/spread_4_2_debug/daemon/net_types.h 2013-11-14 00:17:24 UTC (rev 620)
@@ -60,7 +60,6 @@
#define FORM1_TYPE 0x00001000
#define FORM2_TYPE 0x00002000
#define FORM_TYPE 0x00003000
-/*#define EVS_TYPE 0x00004000*/
#define ARQ_TYPE 0x000f0000
#define RETRANS_TYPE 0x00f00000
@@ -93,7 +92,6 @@
#define Is_form( type ) ( type & FORM_TYPE )
#define Is_form1( type ) ( type & FORM1_TYPE )
#define Is_form2( type ) ( type & FORM2_TYPE )
-/*#define Is_evs( type ) ( (type) & EVS_TYPE )*/
#define Get_arq( type ) ( (type & ARQ_TYPE) >> 16)
#define Set_arq( type, val ) ( (type & ~ARQ_TYPE) | ((val << 16)&ARQ_TYPE) )
Modified: branches/spread_4_2_debug/daemon/protocol.c
===================================================================
--- branches/spread_4_2_debug/daemon/protocol.c 2013-11-12 17:34:53 UTC (rev 619)
+++ branches/spread_4_2_debug/daemon/protocol.c 2013-11-14 00:17:24 UTC (rev 620)
@@ -73,7 +73,7 @@
/* Used to indicate a need to reload configuration at end of current membership */
static bool Prot_Need_Conf_Reload = FALSE;
-bool Just_Installed = 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];
@@ -375,15 +375,6 @@
for( i = 0; i < num_buffered_packets; i++)
{
pack_ptr = Buffered_packets[i].head;
-
- if (pack_ptr->seq == 1 && rand() / (RAND_MAX + 1.0) < 0.9 ) {
-
- Alarm( PROTOCOL, "Prot_handle_bcast: DEBUG dropping packet %d to try to invoke bad edge case\n",
- pack_ptr->seq);
- dispose(Buffered_packets[i].head);
- dispose(Buffered_packets[i].body);
- continue;
- }
/* do we have this packet */
if( pack_ptr->seq <= Aru )
@@ -514,9 +505,10 @@
/* received double token - swallow it */
goto END;
- } else if (Just_Installed) {
- Just_Installed = FALSE;
- Last_token->aru = 0;
+ } 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{
@@ -545,14 +537,16 @@
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 (Just_Installed) {
- Just_Installed = FALSE;
- Last_token->aru = 0;
- }
}
}
@@ -1238,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 );
@@ -1290,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 );
@@ -1310,7 +1305,6 @@
/* set variables for next membership */
if ( Conf_debug_initial_sequence() ) {
- /*Last_token->aru = INITIAL_SEQUENCE_NEAR_WRAP;*/
Highest_seq = INITIAL_SEQUENCE_NEAR_WRAP;
Highest_fifo_seq = INITIAL_SEQUENCE_NEAR_WRAP;
My_aru = INITIAL_SEQUENCE_NEAR_WRAP;
@@ -1319,7 +1313,6 @@
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;
@@ -1329,8 +1322,6 @@
Last_delivered = 0;
}
- Just_Installed = TRUE;
-
Alarm(MEMB, "Discard_packets: Updated Aru to %d for next membership\n", Aru);
GlobalStatus.my_aru = My_aru;
Modified: branches/spread_4_2_debug/daemon/protocol.h
===================================================================
--- branches/spread_4_2_debug/daemon/protocol.h 2013-11-12 17:34:53 UTC (rev 619)
+++ branches/spread_4_2_debug/daemon/protocol.h 2013-11-14 00:17:24 UTC (rev 620)
@@ -56,8 +56,6 @@
#define NORMAL_DOWNQUEUE 0
#define GROUPS_DOWNQUEUE 1
-extern bool Just_Installed;
-
void Prot_init(void);
void Prot_set_down_queue( int queue_type );
void Prot_new_message( down_link *down_ptr, int not_used_in_spread3_p );
Modified: branches/spread_4_2_debug/daemon/spread.c
===================================================================
--- branches/spread_4_2_debug/daemon/spread.c 2013-11-12 17:34:53 UTC (rev 619)
+++ branches/spread_4_2_debug/daemon/spread.c 2013-11-14 00:17:24 UTC (rev 620)
@@ -166,7 +166,7 @@
{
sp_time t = E_get_time();
- srand((int) (t.sec + t.usec));
+ set_rand((int) (t.sec + t.usec));
}
#ifndef ARCH_PC_WIN95
More information about the Spread-cvs
mailing list