For testing, add option to send duplicates of all packets

This commit is contained in:
ehouse 2009-09-26 13:47:51 +00:00
parent 881639c230
commit 547c1758a9
2 changed files with 14 additions and 1 deletions

View file

@ -211,6 +211,7 @@ usage( char* appName, char* msg )
"\t [-V] # hide values in tray\n" "\t [-V] # hide values in tray\n"
"\t [-m] # make the robot duMb (smart is default)\n" "\t [-m] # make the robot duMb (smart is default)\n"
"\t [-l] # disallow hints\n" "\t [-l] # disallow hints\n"
"\t [-L] # duplicate all packets sent\n"
"\t [-P] # pick tiles face up\n" "\t [-P] # pick tiles face up\n"
"\t [-c] # explain robot scores after each move\n" "\t [-c] # explain robot scores after each move\n"
"\t [-C INVITE] # invite used to groups games on relay\n" "\t [-C INVITE] # invite used to groups games on relay\n"
@ -457,6 +458,14 @@ linux_send( const XP_U8* buf, XP_U16 buflen,
#ifdef XWFEATURE_RELAY #ifdef XWFEATURE_RELAY
} else if ( conType == COMMS_CONN_RELAY ) { } else if ( conType == COMMS_CONN_RELAY ) {
nSent = linux_tcp_send( buf, buflen, globals, addrRec ); nSent = linux_tcp_send( buf, buflen, globals, addrRec );
if ( nSent == buflen && globals->params->duplicatePackets ) {
#ifdef DEBUG
XP_S16 sentAgain =
#endif
linux_tcp_send( buf, buflen, globals, addrRec );
XP_ASSERT( sentAgain == nSent );
}
#endif #endif
#if defined XWFEATURE_BLUETOOTH #if defined XWFEATURE_BLUETOOTH
} else if ( conType == COMMS_CONN_BT ) { } else if ( conType == COMMS_CONN_BT ) {
@ -784,7 +793,7 @@ main( int argc, char** argv )
#if defined PLATFORM_GTK #if defined PLATFORM_GTK
"h:I" "h:I"
#endif #endif
"kKf:ln:Nsd:e:r:b:0q:w:Sit:UmvcVP" "kKf:Lln:Nsd:e:r:b:0q:w:Sit:UmvcVP"
#ifdef XWFEATURE_SLOW_ROBOT #ifdef XWFEATURE_SLOW_ROBOT
"z:" "z:"
#endif #endif
@ -860,6 +869,9 @@ main( int argc, char** argv )
case 'm': /* dumb robot */ case 'm': /* dumb robot */
mainParams.gi.robotSmartness = DUMB_ROBOT; mainParams.gi.robotSmartness = DUMB_ROBOT;
break; break;
case 'L':
mainParams.duplicatePackets = XP_TRUE;
break;
case 'l': case 'l':
mainParams.gi.hintsNotAllowed = XP_TRUE; mainParams.gi.hintsNotAllowed = XP_TRUE;
break; break;

View file

@ -63,6 +63,7 @@ typedef struct LaunchParams {
XP_Bool skipWarnings; XP_Bool skipWarnings;
XP_Bool showRobotScores; XP_Bool showRobotScores;
XP_Bool noHeartbeat; XP_Bool noHeartbeat;
XP_Bool duplicatePackets;
#ifdef XWFEATURE_SEARCHLIMIT #ifdef XWFEATURE_SEARCHLIMIT
XP_Bool allowHintRect; XP_Bool allowHintRect;
#endif #endif