From 9083a155e95a87ece39fbb348b9f02cc81e17bda Mon Sep 17 00:00:00 2001 From: qicosmos Date: Mon, 26 Feb 2024 15:54:01 +0800 Subject: [PATCH] make sure thread safe --- include/rest_rpc/connection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rest_rpc/connection.h b/include/rest_rpc/connection.h index 3050aec..f24189c 100644 --- a/include/rest_rpc/connection.h +++ b/include/rest_rpc/connection.h @@ -49,7 +49,7 @@ class connection : public std::enable_shared_from_this, assert(data.size() < MAX_BUF_LEN); auto sp_data = std::make_shared(std::move(data)); std::weak_ptr weak = shared_from_this(); - asio::post([this, weak, sp_data, req_id, req_type] { + asio::post(socket_.get_executor(), [this, weak, sp_data, req_id, req_type] { auto conn = weak.lock(); if (conn) { response_interal(req_id, std::move(sp_data), req_type);