Skip to content

Commit

Permalink
Fix race condition on WebSocket disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
paullouisageneau committed Oct 1, 2024
1 parent 4bf08fd commit 1e6afd9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/impl/websocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ shared_ptr<TcpTransport> WebSocket::setTcpTransport(shared_ptr<TcpTransport> tra
remoteClose();
break;
case State::Disconnected:
remoteClose();
if(state == WebSocket::State::Connecting)
remoteClose();
break;
default:
// Ignore
Expand Down Expand Up @@ -303,7 +304,8 @@ shared_ptr<HttpProxyTransport> WebSocket::initProxyTransport() {
remoteClose();
break;
case State::Disconnected:
remoteClose();
if(state == WebSocket::State::Connecting)
remoteClose();
break;
default:
// Ignore
Expand Down Expand Up @@ -358,7 +360,8 @@ shared_ptr<TlsTransport> WebSocket::initTlsTransport() {
remoteClose();
break;
case State::Disconnected:
remoteClose();
if(state == WebSocket::State::Connecting)
remoteClose();
break;
default:
// Ignore
Expand Down

0 comments on commit 1e6afd9

Please sign in to comment.