From 944b1c8d50a16f244ad043f67e15f4d5e3b7f3c4 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Tue, 18 Jun 2019 11:05:10 +0200 Subject: [PATCH] Refrain from killing known protocol adapters Killing 'engines' that run through an adapter and won't terminate fast enough for XBoard's taste will always be very detrimental, as it will kill the adapter, and leaves the actual engine (for which the adapter was likely waiting) running, preventing the adapter would take action against it. We will thus always refrain from killing engines when XBoard knows they are running through an adapter, because it invoked the adapter itself in response to the -f/sUCI option. --- backend.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend.c b/backend.c index ba9b49b..f43d1e9 100644 --- a/backend.c +++ b/backend.c @@ -789,7 +789,7 @@ UnloadEngine (ChessProgramState *cps) ExitAnalyzeMode(); DoSleep( appData.delayBeforeQuit ); SendToProgram("quit\n", cps); - DestroyChildProcess(cps->pr, 4 + cps->useSigterm); + DestroyChildProcess(cps->pr, 4*!cps->isUCI + cps->useSigterm); } cps->pr = NoProc; if(appData.debugMode) fprintf(debugFP, "Unload %s\n", cps->which); @@ -12089,7 +12089,7 @@ GameEnds (ChessMove result, char *resultDetails, int whosays) ExitAnalyzeMode(); DoSleep( appData.delayBeforeQuit ); SendToProgram("quit\n", &first); - DestroyChildProcess(first.pr, 4 + first.useSigterm); + DestroyChildProcess(first.pr, 4*!first.isUCI + first.useSigterm); first.reload = TRUE; } first.pr = NoProc; @@ -12114,7 +12114,7 @@ GameEnds (ChessMove result, char *resultDetails, int whosays) if (second.pr != NoProc) { DoSleep( appData.delayBeforeQuit ); SendToProgram("quit\n", &second); - DestroyChildProcess(second.pr, 4 + second.useSigterm); + DestroyChildProcess(second.pr, 4*!second.isUCI + second.useSigterm); second.reload = TRUE; } second.pr = NoProc; @@ -14769,12 +14769,12 @@ ExitEvent (int status) DoSleep( appData.delayBeforeQuit ); SendToProgram("quit\n", &first); - DestroyChildProcess(first.pr, 4 + first.useSigterm /* [AS] first.useSigterm */ ); + DestroyChildProcess(first.pr, 4*!first.isUCI + first.useSigterm /* [AS] first.useSigterm */ ); } if (second.pr != NoProc) { DoSleep( appData.delayBeforeQuit ); SendToProgram("quit\n", &second); - DestroyChildProcess(second.pr, 4 + second.useSigterm /* [AS] second.useSigterm */ ); + DestroyChildProcess(second.pr, 4*!second.isUCI + second.useSigterm /* [AS] second.useSigterm */ ); } if (first.isr != NULL) { RemoveInputSource(first.isr); -- 1.7.0.4