Fixed string buffer not being compied
This commit is contained in:
parent
66ed68bf7b
commit
060c226801
@ -46,7 +46,9 @@ bool GWSocket::close()
|
||||
std::lock_guard<std::recursive_mutex> guard(this->queueMutex);
|
||||
this->writeQueue.emplace_back(OUT_DISCONNECT);
|
||||
}
|
||||
this->checkWriting();
|
||||
if (expected == STATE_CONNECTED) {
|
||||
this->checkWriting();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -99,6 +99,7 @@ protected:
|
||||
void checkWriting();
|
||||
void hostResolvedStep(const boost::system::error_code &ec, tcp::resolver::iterator it);
|
||||
bool writing = { false };
|
||||
std::string messageToWrite = "";
|
||||
void doClose();
|
||||
bool setDisconnectingCAS();
|
||||
std::unordered_map<std::string, std::string> cookies;
|
||||
|
@ -102,7 +102,8 @@ void SSLWebSocket::asyncRead()
|
||||
|
||||
void SSLWebSocket::asyncWrite(std::string message)
|
||||
{
|
||||
this->getWS()->async_write(boost::asio::buffer(message), boost::bind(&SSLWebSocket::onWrite, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||
this->messageToWrite = message;
|
||||
this->getWS()->async_write(boost::asio::buffer(this->messageToWrite), boost::bind(&SSLWebSocket::onWrite, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||
}
|
||||
|
||||
void SSLWebSocket::closeSocket()
|
||||
|
@ -23,7 +23,8 @@ void WebSocket::asyncRead()
|
||||
|
||||
void WebSocket::asyncWrite(std::string message)
|
||||
{
|
||||
this->getWS()->async_write(boost::asio::buffer(message), boost::bind(&WebSocket::onWrite, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||
this->messageToWrite = message;
|
||||
this->getWS()->async_write(boost::asio::buffer(this->messageToWrite), boost::bind(&WebSocket::onWrite, this, boost::placeholders::_1, boost::placeholders::_2));
|
||||
}
|
||||
|
||||
void WebSocket::closeSocket()
|
||||
|
@ -21,6 +21,7 @@ protected:
|
||||
void asyncWrite(std::string message);
|
||||
void asyncCloseSocket();
|
||||
void closeSocket();
|
||||
std::string messageToWrite = "";
|
||||
std::atomic<websocket::stream<tcp::socket>*> ws{ nullptr };
|
||||
//This is not an atomic function, it only ensures visibility.
|
||||
//Callers have to make sure that atomicity is not required/ensured otherwise
|
||||
|
Loading…
Reference in New Issue
Block a user