From: H.G. Muller Date: Tue, 17 Apr 2012 18:09:56 +0000 (+0200) Subject: Wait for uciok before handling GUI input X-Git-Tag: v2.0~38 X-Git-Url: http://winboard.nl/cgi-bin?p=uci2wb.git;a=commitdiff_plain;h=bb98ac73064aee6dcae34c236e466abf4b5dd6a3 Wait for uciok before handling GUI input WinBoard does not apply a feature timeout when restarting an engine that had reuse=0, but immediately starts sending commands. This caused the memory command to be ignored, because it arrived when UCI2WB had not seen the engine's Hash option yet. Now UCI2WB stalls processing GUI commands after receiving 'protover' until it sees 'uciok' from the engine. --- diff --git a/UCI2WB.c b/UCI2WB.c index 2ea2512..fa37c42 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -239,7 +239,7 @@ Engine2GUI() if(sscanf(line, "id name %[^\n]", name) == 1) printf("feature myname=\"%s (U%cI2WB)\"\n", name, sc-32); } else if(!strcmp(command, "readyok")) { pause = 0; Sync(WAKEUP); } // resume processing of GUI commands - else if(sscanf(command, "u%ciok", &c)==1 && c==sc) printf("feature smp=1 memory=%d done=1\n", hasHash); // done with options + else if(sscanf(command, "u%ciok", &c)==1 && c==sc) printf("feature smp=1 memory=%d done=1\n", hasHash), Sync(WAKEUP); // done with options } } @@ -332,7 +332,8 @@ GUI2Engine() if(!variants) variants = sc=='s' ? "shogi,5x5+5_shogi" : VARIANTS; printf("feature variants=\"%s\" setboard=1 usermove=1 debug=1 ping=1 reuse=0 done=0\n", variants); printf("feature option=\"UCI2WB debug output -check %d\"\n", debug); - fprintf(toE, "u%ci\n", sc); // this prompts UCI engine for options + fprintf(toE, "u%ci\n", sc); fflush(toE); // this prompts UCI engine for options + Sync(PAUSE); // wait for uciok } else if(!strcmp(command, "setboard")) { if(strstr(line+9, " b ")) stm = BLACK;