diff --git a/src/app.cpp b/src/app.cpp index 05cc0f7..85607e5 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -5047,17 +5047,17 @@ void App::stopEmbeddedDaemon() // daemon flush state, save block indexes, close sockets, etc. bool stop_sent = false; - // Try the existing RPC connection first + // Try the existing RPC connection first. beginShutdown() called rpc_->requestAbort() to unblock any + // in-flight request — but that sticky abort (cleared only by connect()) would make THIS "stop" self- + // abort mid-flight (CURLE_ABORTED_BY_CALLBACK). The old async rpc_->stop() swallowed that error yet + // set stop_sent=true, so the daemon never heard "stop" and the working temp-connection fallback was + // skipped — which is why "Stop external daemon" left an external dragonxd running (it only died via + // the 20s force-kill). Clear the abort and send SYNCHRONOUSLY so real success is surfaced. if (rpc_ && rpc_->isConnected()) { DEBUG_LOGF("Sending stop command via existing RPC connection...\n"); - try { - rpc_->stop([](const json&) { - DEBUG_LOGF("Stop command acknowledged by daemon\n"); - }); + rpc_->clearAbort(); + if (sendStopCommandSafely(*rpc_, "existing connection stop")) stop_sent = true; - } catch (...) { - DEBUG_LOGF("Failed to send stop via existing connection\n"); - } } // If the main connection wasn't established (e.g. daemon was still