diff options
| author | Aargh Rai <aargh.rai+git@gmail.com> | 2026-08-23 16:06:42 +0530 |
|---|---|---|
| committer | Aargh Rai <aargh.rai+git@gmail.com> | 2026-08-23 16:06:42 +0530 |
| commit | 99de764d1d1b936594643e34ae4d2c4a239f69db (patch) | |
| tree | f45884164774e760e9ae37d3c37ccfe80dbbc836 /src/uci/response.c | |
| parent | 54afeb6dd89fffae92274cb6fe2e9a86fd57c6e3 (diff) | |
phase C, D & E
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; } |
