From 62fcdc805ab8e06adff95f9726dd0cd08f0aa567 Mon Sep 17 00:00:00 2001 From: Intel Date: Mon, 5 May 2014 10:32:08 -0400 Subject: [PATCH] Prevent multiple thread writes --- src/server/poolserver/Stratum/Client.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/server/poolserver/Stratum/Client.h b/src/server/poolserver/Stratum/Client.h index 8af5183..a929f34 100644 --- a/src/server/poolserver/Stratum/Client.h +++ b/src/server/poolserver/Stratum/Client.h @@ -56,6 +56,8 @@ namespace Stratum void SendMessage(JSON msg) { + boost::unique_lock lock(_mtxWrite); + std::string data = msg.ToString(); data += '\n'; sLog.Debug(LOG_SERVER, "Sending: %s", data.c_str()); @@ -139,6 +141,7 @@ namespace Stratum std::string _recvMessage; tcp::socket _socket; asio::strand _ioStrand; + boost::mutex _mtxWrite; uint32 _ip; uint64 _id;