Skip to content

Commit

Permalink
Merge pull request #1266 from paullouisageneau/fix-ws-race-disconnect
Browse files Browse the repository at this point in the history
Fix race condition on WebSocket disconnect
  • Loading branch information
paullouisageneau authored Oct 2, 2024
2 parents b068c8f + 1e6afd9 commit 9bbc79b
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 9bbc79b

Please sign in to comment.