diff options
Diffstat (limited to 'src/uci/response.c')
| -rw-r--r-- | src/uci/response.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/uci/response.c b/src/uci/response.c index ff89f8d..81459d6 100644 --- a/src/uci/response.c +++ b/src/uci/response.c @@ -35,7 +35,10 @@ void handle_initial(uci_state_t *state, uci_cmd_t cmd) { print_setting(state->option_settings[i]); } // --- + // flush around the handshake so piped GUIs see responses immediately + fflush(stdout); printf("uciok\n"); + fflush(stdout); state->current_state = UCI_STATE_IDLE; } @@ -164,10 +167,11 @@ void handle_idle(uci_state_t *state, uci_cmd_t cmd) { void handle_sync(uci_state_t *state, uci_cmd_t cmd) { // TIMEOUT NOTICE: THE FOLLOWING BLOCK SHOULDN'T TAKE MORE THAN 5 SECONDS - - + if (cmd.empty || strcmp(cmd.root, "isready") != 0) { + // commands sent while a sync is pending must still be handled. + return handle_idle(state, cmd); + } - // --- printf("readyok\n"); state->current_state = UCI_STATE_IDLE; } |
