aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zenhttp/websocketasio.cpp15
-rw-r--r--zenserver-test/zenserver-test.cpp4
2 files changed, 9 insertions, 10 deletions
diff --git a/zenhttp/websocketasio.cpp b/zenhttp/websocketasio.cpp
index e9d065624..12b762b12 100644
--- a/zenhttp/websocketasio.cpp
+++ b/zenhttp/websocketasio.cpp
@@ -754,11 +754,7 @@ WsServer::CloseConnection(std::shared_ptr<WsConnection> Connection, const std::e
{
if (Ec)
{
- ZEN_LOG_INFO(LogWebSocket,
- "connection '{}' closed, ERROR '{}' error code '{}'",
- Connection->Id().Value(),
- Ec.message(),
- Ec.value());
+ ZEN_LOG_INFO(LogWebSocket, "connection '{}' closed, reason '{} ({})'", Connection->Id().Value(), Ec.message(), Ec.value());
}
else
{
@@ -1304,6 +1300,13 @@ WsClient::ReadMessage()
m_ReadBuffer,
asio::transfer_at_least(1),
[Self = AsShared()](const asio::error_code& Ec, std::size_t ByteCount) mutable {
+ const WebSocketState State = Self->State();
+
+ if (State == WebSocketState::kDisconnected)
+ {
+ return;
+ }
+
if (Ec)
{
ZEN_LOG_WARN(LogWsClient, "read message FAILED, reason '{}'", Ec.message());
@@ -1311,8 +1314,6 @@ WsClient::ReadMessage()
return Self->Disconnect();
}
- const WebSocketState State = Self->State();
-
switch (State)
{
case WebSocketState::kHandshaking:
diff --git a/zenserver-test/zenserver-test.cpp b/zenserver-test/zenserver-test.cpp
index 405222398..51863a861 100644
--- a/zenserver-test/zenserver-test.cpp
+++ b/zenserver-test/zenserver-test.cpp
@@ -2610,8 +2610,6 @@ public:
{
m_Error = Error;
}
-
- m_Running = false;
});
}
@@ -2747,7 +2745,7 @@ TEST_CASE("websocket.basic")
}
WebSocket->Disconnect();
-
+
IoCtx.stop();
IoDispatcher.Stop();
}