From 102910e97491e60b2c1c9f55e3c28679cba5e8fc Mon Sep 17 00:00:00 2001 From: Luke Gehorsam Date: Fri, 26 Jan 2024 16:04:35 -0500 Subject: [PATCH] set disconnected state prior to firing disconnected event in wslay --- impl/wsWslay/NWebsocketWslay.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/impl/wsWslay/NWebsocketWslay.cpp b/impl/wsWslay/NWebsocketWslay.cpp index b94b89dd..609e3839 100644 --- a/impl/wsWslay/NWebsocketWslay.cpp +++ b/impl/wsWslay/NWebsocketWslay.cpp @@ -229,21 +229,21 @@ namespace Nakama { } this->_io->close(); + + _connected = false; + _state = State::Disconnected; + + // after close frame was sent or received wslay_context is tainted and need to be recreated + _ctx.reset(nullptr); + if (code) { - assert(_connected); NRtClientDisconnectInfo info; info.code = code.value(); info.remote = remote; fireOnDisconnected(info); } - _connected = false; - _state = State::Disconnected; - - // after close frame was sent or received wslay_context is tainted and need to be recreated - _ctx.reset(nullptr); } - uint32_t NWebsocketWslay::getActivityTimeout() const { return this->_timeout; }