mirror of
https://github.com/GOSTSec/poolserver
synced 2025-01-15 01:00:10 +00:00
Prevent multiple thread writes
This commit is contained in:
parent
43c05ff10e
commit
62fcdc805a
@ -56,6 +56,8 @@ namespace Stratum
|
|||||||
|
|
||||||
void SendMessage(JSON msg)
|
void SendMessage(JSON msg)
|
||||||
{
|
{
|
||||||
|
boost::unique_lock<boost::mutex> lock(_mtxWrite);
|
||||||
|
|
||||||
std::string data = msg.ToString();
|
std::string data = msg.ToString();
|
||||||
data += '\n';
|
data += '\n';
|
||||||
sLog.Debug(LOG_SERVER, "Sending: %s", data.c_str());
|
sLog.Debug(LOG_SERVER, "Sending: %s", data.c_str());
|
||||||
@ -139,6 +141,7 @@ namespace Stratum
|
|||||||
std::string _recvMessage;
|
std::string _recvMessage;
|
||||||
tcp::socket _socket;
|
tcp::socket _socket;
|
||||||
asio::strand _ioStrand;
|
asio::strand _ioStrand;
|
||||||
|
boost::mutex _mtxWrite;
|
||||||
uint32 _ip;
|
uint32 _ip;
|
||||||
uint64 _id;
|
uint64 _id;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user