From 08789c4097defe6d66ea9a5ce51a91bd18e96fb1 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Wed, 17 Aug 2011 19:48:55 -0700 Subject: [PATCH] call server_do() up to five times to allow some extra work to get done. Required if a host is also a robot. --- xwords4/android/XWords4/jni/xwjni.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c index ca1d65538..8d9c9b5cd 100644 --- a/xwords4/android/XWords4/jni/xwjni.c +++ b/xwords4/android/XWords4/jni/xwjni.c @@ -1017,10 +1017,16 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1receiveMessage (void)server_do( server, NULL ); /* } */ (void)server_receiveMessage( server, stream ); - /* in case MORE work's pending */ - /* for ( notDone = XP_TRUE; notDone; ) { */ - (void)server_do( server, NULL ); - /* } */ + /* in case MORE work's pending. Multiple calls are required in at + least one case, where I'm a host handling client registration *AND* + I'm a robot. Only one server_do and I'll never make that first + robot move. That's because comms can't detect a duplicate initial + packet (in validateInitialMessage()). */ + int ii; + XP_Bool notDone; + for ( ii = 0, notDone = XP_TRUE; notDone && ii < 5; ++ii ) { + (void)server_do( server, ¬Done ); + } } stream_destroy( stream );