(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

@ -1,6 +1,10 @@
# Changelog
All changes to this project will be documented in this file.
## [9.10.2] - 2020-07-24
(websocket client) reset WebSocketTransport onClose callback in the WebSocket destructor
## [9.10.1] - 2020-07-24
(websocket server) reset client websocket callback when the connection is closed

View File

@ -46,6 +46,7 @@ namespace ix
WebSocket::~WebSocket()
{
stop();
_ws.setOnCloseCallback(nullptr);
}
void WebSocket::setUrl(const std::string& url)

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;

View File

@ -6,4 +6,4 @@
#pragma once
#define IX_WEBSOCKET_VERSION "9.10.1"
#define IX_WEBSOCKET_VERSION "9.10.2"