Fixing crash when sending data to a closed websocket connection.

This commit is contained in:
lotodore
2013-09-16 22:57:12 +02:00
parent 496a668a15
commit c6c044b784
+5 -1
View File
@@ -68,7 +68,11 @@ WebSendBuffer::InternalStorePacket(boost::shared_ptr<SessionData> session, boost
google::protobuf::uint8 *buf = new google::protobuf::uint8[packetSize];
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;
}