Fixing crash when sending data to a closed websocket connection.
This commit is contained in:
@@ -68,7 +68,11 @@ WebSendBuffer::InternalStorePacket(boost::shared_ptr<SessionData> session, boost
|
|||||||
google::protobuf::uint8 *buf = new google::protobuf::uint8[packetSize];
|
google::protobuf::uint8 *buf = new google::protobuf::uint8[packetSize];
|
||||||
packet->GetMsg()->SerializeWithCachedSizesToArray(buf);
|
packet->GetMsg()->SerializeWithCachedSizesToArray(buf);
|
||||||
|
|
||||||
m_webData->webSocketServer->send(m_webData->webHandle, string((const char *)buf, packetSize), websocketpp::frame::opcode::BINARY);
|
boost::system::error_code ec;
|
||||||
|
m_webData->webSocketServer->send(m_webData->webHandle, string((const char *)buf, packetSize), websocketpp::frame::opcode::BINARY, ec);
|
||||||
|
if (ec) {
|
||||||
|
SetCloseAfterSend();
|
||||||
|
}
|
||||||
|
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user