(websocket client) reset WebSocketTransport onClose callback in the WebSocket destructor

This commit is contained in:
Benjamin Sergeant
2020-07-24 10:03:29 -07:00
parent c26a2d5d39
commit 0f026c5da2
4 changed files with 10 additions and 2 deletions

View File

@ -180,7 +180,10 @@ namespace ix
if (readyState == ReadyState::CLOSED)
{
std::lock_guard<std::mutex> lock(_closeDataMutex);
_onCloseCallback(_closeCode, _closeReason, _closeWireSize, _closeRemote);
if (_onCloseCallback)
{
_onCloseCallback(_closeCode, _closeReason, _closeWireSize, _closeRemote);
}
_closeCode = WebSocketCloseConstants::kInternalErrorCode;
_closeReason = WebSocketCloseConstants::kInternalErrorMessage;
_closeWireSize = 0;