From 547c1758a9a9db4eb6b0afa550a54ad9daf37702 Mon Sep 17 00:00:00 2001 From: ehouse Date: Sat, 26 Sep 2009 13:47:51 +0000 Subject: [PATCH] For testing, add option to send duplicates of all packets --- xwords4/linux/linuxmain.c | 14 +++++++++++++- xwords4/linux/main.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/xwords4/linux/linuxmain.c b/xwords4/linux/linuxmain.c index 08c924e87..4fc056864 100644 --- a/xwords4/linux/linuxmain.c +++ b/xwords4/linux/linuxmain.c @@ -211,6 +211,7 @@ usage( char* appName, char* msg ) "\t [-V] # hide values in tray\n" "\t [-m] # make the robot duMb (smart is default)\n" "\t [-l] # disallow hints\n" + "\t [-L] # duplicate all packets sent\n" "\t [-P] # pick tiles face up\n" "\t [-c] # explain robot scores after each move\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 } else if ( conType == COMMS_CONN_RELAY ) { 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 #if defined XWFEATURE_BLUETOOTH } else if ( conType == COMMS_CONN_BT ) { @@ -784,7 +793,7 @@ main( int argc, char** argv ) #if defined PLATFORM_GTK "h:I" #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 "z:" #endif @@ -860,6 +869,9 @@ main( int argc, char** argv ) case 'm': /* dumb robot */ mainParams.gi.robotSmartness = DUMB_ROBOT; break; + case 'L': + mainParams.duplicatePackets = XP_TRUE; + break; case 'l': mainParams.gi.hintsNotAllowed = XP_TRUE; break; diff --git a/xwords4/linux/main.h b/xwords4/linux/main.h index 2ebaf700f..ae1e0798f 100644 --- a/xwords4/linux/main.h +++ b/xwords4/linux/main.h @@ -63,6 +63,7 @@ typedef struct LaunchParams { XP_Bool skipWarnings; XP_Bool showRobotScores; XP_Bool noHeartbeat; + XP_Bool duplicatePackets; #ifdef XWFEATURE_SEARCHLIMIT XP_Bool allowHintRect; #endif