Skip to content

Commit 196aaf4

Browse files
committed
Websocket: Fix an issue with the engine's state during close.
1 parent 61a032b commit 196aaf4

File tree

1 file changed

+1
-1
lines changed
  • websocket/src/main/java/co/casterlabs/commons/websocket

1 file changed

+1
-1
lines changed

websocket/src/main/java/co/casterlabs/commons/websocket/_Engine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public void close() {
169169
this.stateLock.lock();
170170
try {
171171
if (this.state != _State.CONNECTED) return; // Silent return.
172+
this.state = _State.CLOSED;
172173

173174
try {
174175
this.writer.sendFrame(true, _OpCode.CLOSE, new byte[0], 0, 0);
@@ -183,7 +184,6 @@ public void close() {
183184

184185
this.client.listener.onClosed(this.client);
185186
} finally {
186-
this.state = _State.CLOSED;
187187
this.stateLock.unlock();
188188
}
189189
}

0 commit comments

Comments
 (0)