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

jschultz at spread.org jschultz at spread.org
Wed Jan 22 12:39:27 EST 2014


Author: jschultz
Date: 2014-01-22 12:39:27 -0500 (Wed, 22 Jan 2014)
New Revision: 677

Modified:
   trunk/daemon/protocol.c
Log:
Cleanup; mostly whitespace changes


Modified: trunk/daemon/protocol.c
===================================================================
--- trunk/daemon/protocol.c	2014-01-22 08:21:47 UTC (rev 676)
+++ trunk/daemon/protocol.c	2014-01-22 17:39:27 UTC (rev 677)
@@ -540,65 +540,65 @@
 		Flip_token_body( New_token.elements[1].buf, Token );
 
         /* 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 ) )
+
+        if( Memb_state() != EVS && Token->seq > MAX_WRAP_SEQUENCE_VALUE )
         {
-	    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 */
+	    Alarmp( SPLOG_WARNING, PROTOCOL, "Prot_handle_token: seq (%d) about to rollover; swallowing token to trigger membership + reset it.\n", Token->seq );
             goto END;
         }
 
 	if( Conf_leader( Memb_active_ptr() ) == My.id )
 	{
-		if( Get_arq(Token->type) != Get_arq(Last_token->type) )
+		if( Get_arq( 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 */
-		    goto END; 
+		        Alarmp( SPLOG_INFO, PROTOCOL, "Prot_handle_token: leader swallowing repeated token; type = %d; retrans = %d; arq = %d\n", 
+				Get_arq( Token->type ), Get_retrans( Token->type ), Get_arq( Last_token->type ) );
+			goto END; 
 
-		} else if (Memb_Just_Installed) {
+		} else if( Memb_Just_Installed ) 
+		{
 		    Memb_Just_Installed  = FALSE;
 		    /* NOTE: we do this now rather than just when we installed to allow proper token retransmissions */
 		    Last_token->aru = 0;  /* wipe out EVS aru on last token due to transitioning from EVS -> OP */
 		    Alarmp(SPLOG_INFO, PROTOCOL, "Prot_handle_token: leader just installed; setting Last_token->aru = 0!\n");
 		}
 
-	}else{
-		if( Get_arq(Token->type) == Get_arq(Last_token->type) )
+	} else {
+		if( Get_arq( Token->type ) == Get_arq( Last_token->type ) )
 		{
-		    if( Get_retrans(Token->type) > Get_retrans(Last_token->type) )
+		    if( Get_retrans( Token->type ) > Get_retrans( Last_token->type ) )
 		    {
-			val = Get_retrans(Token->type);
+			/* asked to send token again (almost lost) */
+			val = Get_retrans( Token->type );
 			Last_token->type = Set_retrans(Last_token->type,val);
-			/* asked to send token again (almost lost) */
-			Alarm( PROTOCOL,
-			    "Prot_handle_token: not leader, asked to retrans %d %d\n",
-				Get_arq(Token->type), val );
+			Alarmp( SPLOG_INFO, PROTOCOL, "Prot_handle_token: not leader, asked to retrans %d %d\n",
+				Get_arq( Token->type ), val );
 			Prot_token_hurry();
-		    }else{
-			Alarm( PROTOCOL,
-			    "Prot_handle_token: not leader, swallow same token %d %d\n",
-	   			Get_arq(Token->type), Get_retrans(Token->type) );
+
+		    } else {
+		      Alarmp( SPLOG_INFO, PROTOCOL, "Prot_handle_token: not leader, swallow same token %d %d\n",
+			      Get_arq( Token->type ), Get_retrans( Token->type ) );
 		    }
+
 		    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) );
+		} else if( Get_arq( Token->type ) != ( ( Get_arq( Last_token->type ) + 1 ) % 0x10 ) ) {
+
+		  Alarmp( SPLOG_INFO, 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 ) );
+
 		  goto END;
 
 		} else {
 
-			if (Memb_Just_Installed) {
+			if( Memb_Just_Installed ) {
 			  Memb_Just_Installed  = FALSE;
 			  /* NOTE: we do this now rather than just when we installed to allow proper token retransmissions */
 			  Last_token->aru = 0;  /* wipe out EVS aru on last token due to transitioning from EVS -> OP */
 			  Alarmp(SPLOG_INFO, PROTOCOL, "Prot_handle_token: not-leader just installed; setting Last_token->aru = 0!\n");
 			}
 
-                        if ( Get_retrans(Token->type) > 0 ) {
+                        if( Get_retrans( Token->type ) > 0 ) {
                                 GlobalStatus.token_hurry++;
                         }
                 }




More information about the Spread-cvs mailing list