diff --git a/src/core/rpc/server.cpp b/src/core/rpc/server.cpp index 3474fa7e1f..358afa357a 100644 --- a/src/core/rpc/server.cpp +++ b/src/core/rpc/server.cpp @@ -25,6 +25,7 @@ void Server::Start() { void Server::Stop() { udp_server.reset(); + NewRequestCallback(nullptr); // Notify the RPC server to end } void Server::NewRequestCallback(std::unique_ptr new_request) { diff --git a/src/core/rpc/udp_server.cpp b/src/core/rpc/udp_server.cpp index 185450f5ea..a560973776 100644 --- a/src/core/rpc/udp_server.cpp +++ b/src/core/rpc/udp_server.cpp @@ -20,10 +20,7 @@ public: new_request_callback(std::move(new_request_callback)) { StartReceive(); - worker_thread = std::thread([this] { - io_context.run(); - this->new_request_callback(nullptr); - }); + worker_thread = std::thread([this] { io_context.run(); }); } ~Impl() {