fixup re-tx green again default tip
authorstephen
Sun, 30 Mar 2014 12:35:17 +0100
changeset 4066a4f161394f
parent 39 913775c1c818
fixup re-tx green again
include/ltp_int.h
src/ltp.cc
     1.1 --- a/include/ltp_int.h	Sat Mar 29 13:10:05 2014 +0000
     1.2 +++ b/include/ltp_int.h	Sun Mar 30 12:35:17 2014 +0100
     1.3 @@ -46,6 +46,9 @@
     1.4  
     1.5  #include "ltp_codec.h"
     1.6  
     1.7 +/// This is for the MUDSAT build, TODO:  make this a configure param later
     1.8 +#define MUDSAT
     1.9 +
    1.10  
    1.11  /// a type for ltp structure instances (so I can flatten to file!)
    1.12  typedef int ltp_instance;
    1.13 @@ -125,7 +128,7 @@
    1.14  #define LTP_MIB_DEFAULT_CANTXLIMIT	1		///< should be small anyhow
    1.15  #define LTP_MIB_DEFAULT_GARBAGE		60*60*24 ///< clean up sockets once per day by default
    1.16  #define LTP_MIB_DEFAULT_LINGER		false   ///< immediately clean up socket state by default
    1.17 -#define LTP_MIB_DEFAULT_INACTIVITY	60*2 	///< allow 2 punctuated minutes of doing nothing
    1.18 +#define LTP_MIB_DEFAULT_INACTIVITY	60*10 	///< allow 2 punctuated minutes of doing nothing
    1.19  #define LTP_MAX_COOKIE				16		///< max cookie len (Bytes)
    1.20  #define LTP_MIN_COOKIE				4		///< min cookie len (Bytes)
    1.21  #define LTP_MAX_COOKIE_GRACE		60*60*24	///< max cookie grace period (1 day)
    1.22 @@ -259,6 +262,9 @@
    1.23  	int						redtide; ///< the highest tide of red we've seen for an inbound block
    1.24  	bool 					redcomplete; ///< whether red data is complete for an outbound block
    1.25  	bool					eobsent; ///< whether the eob (green or red has been sent)
    1.26 +#ifdef MUDSAT
    1.27 +    int                     mudsat_re_tx_ctr; ///<  counter for how many MUDSSAT re-tx's to do
    1.28 +#endif
    1.29  } ltp_block;
    1.30  
    1.31  /// the state of a segment
     2.1 --- a/src/ltp.cc	Sat Mar 29 13:10:05 2014 +0000
     2.2 +++ b/src/ltp.cc	Sun Mar 30 12:35:17 2014 +0100
     2.3 @@ -220,11 +220,8 @@
     2.4  /// to be saved to CF.
     2.5  #define LTP_STATE_CHANGED ltp_state_changed=true;
     2.6  
     2.7 +#ifdef MUDSAT
     2.8  // SF MUDSAT testing: see what happens if I just set all the segments of this
     2.9 -#define MUDSAT
    2.10 -#ifdef MUDSAT
    2.11 -// all green block to indicate they were not sent, but just once
    2.12 -int green_re_tx_countdown=2; // move to "global" (gulp:-)
    2.13  
    2.14  // SF MUDSAT testing: default ciphersuite stuff
    2.15  // TODO: fixme
    2.16 @@ -356,20 +353,16 @@
    2.17  // all green block to indicate they were not sent, but just once
    2.18  int ltp_green_re_tx(ltp_segment *seg)
    2.19  {
    2.20 -
    2.21  	int blockid=seg->parent->id;
    2.22  	ltp_segment *segments=ltp_state_var.txq.segments; 
    2.23 -
    2.24  	// go through all segments for that block and set their
    2.25  	// state to LTP_PS_WAITING_SEND and see what happens
    2.26 -
    2.27  	for (int i=0;i!=ltp_state_var.txq.nsegments;i++) {
    2.28  		if (segments[i].parent->id==blockid) {
    2.29  			// mark for re-tx
    2.30  			segments[i].state=LTP_PS_WAITING_SEND;
    2.31  		}
    2.32  	}
    2.33 -	
    2.34  	return(LTP_OK);
    2.35  }
    2.36  #endif
    2.37 @@ -2470,6 +2463,13 @@
    2.38  	blocks[nblocks-1].redtide=LTP_REDTIDE_INIT;
    2.39  	blocks[nblocks-1].redcomplete=false;
    2.40  	blocks[nblocks-1].eobsent=false;
    2.41 +#ifdef MUDSAT
    2.42 +#ifdef LTP_VERBOSE
    2.43 +    snprintf(ltpstr,LTPSTR_LEN,"MUDSAT setiting blcok re-tx ctr to 2\n");
    2.44 +    ltp_log(LTP_LOG_MAX,ltpstr);
    2.45 +#endif
    2.46 +	blocks[nblocks-1].mudsat_re_tx_ctr=2;
    2.47 +#endif
    2.48  	LTP_STATE_CHANGED
    2.49  	return(LTP_OK);
    2.50  }
    2.51 @@ -2552,6 +2552,13 @@
    2.52  	}
    2.53  	blocks[nblocks-1].redcomplete=false;
    2.54  	blocks[nblocks-1].eobsent=false;
    2.55 +#ifdef MUDSAT
    2.56 +#ifdef LTP_VERBOSE
    2.57 +    snprintf(ltpstr,LTPSTR_LEN,"MUDSAT setiting blcok re-tx ctr to 2\n");
    2.58 +    ltp_log(LTP_LOG_MAX,ltpstr);
    2.59 +#endif
    2.60 +	blocks[nblocks-1].mudsat_re_tx_ctr=2;
    2.61 +#endif
    2.62  	// maybe check extensions to see what's what
    2.63  	LTP_STATE_CHANGED;
    2.64  	*block=&blocks[nblocks-1];
    2.65 @@ -2607,7 +2614,7 @@
    2.66  		ov.keyidlen=strlen(def_keyid);
    2.67  		memcpy(ov.keyid,def_keyid,ov.keyidlen);
    2.68  #ifdef LTP_VERBOSE
    2.69 -		snprintf(ltpstr,LTPSTR_LEN,"Setting DEFAULT ciphersuite to %d, keyid to |%s| in ltp_setsockopt\n",
    2.70 +		snprintf(ltpstr,LTPSTR_LEN,"MUDSAT Setting DEFAULT ciphersuite to %d, keyid to |%s| in ltp_setsockopt\n",
    2.71  			ov.ciphersuite,octets2str(ov.keyid,ov.keyidlen));
    2.72  		ltp_log(LTP_LOG_ADV,ltpstr);
    2.73  #endif
    2.74 @@ -3079,6 +3086,13 @@
    2.75  	blocks[nblocks-1].fwd_scopes.alloced=0;
    2.76  	blocks[nblocks-1].fwd_scopes.lbs=NULL;
    2.77  	blocks[nblocks-1].fwd_scopes.ubs=NULL;
    2.78 +#ifdef MUDSAT
    2.79 +#ifdef LTP_VERBOSE
    2.80 +    snprintf(ltpstr,LTPSTR_LEN,"MUDSAT setiting blcok re-tx ctr to 2\n");
    2.81 +    ltp_log(LTP_LOG_MAX,ltpstr);
    2.82 +#endif
    2.83 +	blocks[nblocks-1].mudsat_re_tx_ctr=2;
    2.84 +#endif
    2.85  	if (ion_mode) {
    2.86  		blocks[nblocks-1].csi=1;
    2.87  	} else {
    2.88 @@ -5353,16 +5367,25 @@
    2.89  					if (segments[i].parent->parent->opts.redlen==LTP_ALLGREEN 
    2.90  						&& segments[i].seg.type==LTPC_SEG_DS
    2.91  						&& segments[i].seg.val.ds.eob) {
    2.92 -							segments[i].parent->complete=true;
    2.93  
    2.94  #ifdef MUDSAT
    2.95  							// SF MUDSAT testing: see what happens if I just set all the segments of this
    2.96  							// all green block to indicate they were not sent, but just once
    2.97 -							if (green_re_tx_countdown!=0) {
    2.98 +							if (segments[i].parent->mudsat_re_tx_ctr>0) {
    2.99 +#ifdef LTP_VERBOSE
   2.100 +								snprintf(ltpstr,LTPSTR_LEN,"MUDSAT Re-TXing the block\n");
   2.101 +								ltp_log(LTP_LOG_MAX,ltpstr);
   2.102 +#endif
   2.103  								int rtrv=ltp_green_re_tx(&segments[i]);
   2.104  								if (rtrv) LTPERR(rtrv);
   2.105 -								green_re_tx_countdown--;
   2.106 -							} 
   2.107 +								segments[i].parent->mudsat_re_tx_ctr--;
   2.108 +							} else {
   2.109 +#ifdef LTP_VERBOSE
   2.110 +								snprintf(ltpstr,LTPSTR_LEN,"MUDSAT NO longer Re-TXing the block\n");
   2.111 +								ltp_log(LTP_LOG_MAX,ltpstr);
   2.112 +#endif
   2.113 +							    segments[i].parent->complete=true;
   2.114 +                            } 
   2.115  #endif
   2.116  							
   2.117  					}