Skip to content

Commit

Permalink
set disconnected state prior to firing disconnected event in wslay
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Gehorsam committed Jan 26, 2024
1 parent 98cce48 commit 102910e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions impl/wsWslay/NWebsocketWslay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 102910e

Please sign in to comment.