Skip to content

Commit 1bc60f7

Browse files
authored
Merge pull request #567 from felippeduran/fix_protocol_error
Fix duplicate call of flushAndClose() if status code is PROTOCOL_ERROR on close() method.
2 parents 954ab37 + f1eeff4 commit 1bc60f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/org/java_websocket/WebSocketImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,11 @@ public void close( int code, String message, boolean remote ) {
447447
} else if( code == CloseFrame.FLASHPOLICY ) {
448448
assert ( remote );
449449
flushAndClose( CloseFrame.FLASHPOLICY, message, true );
450+
} else if( code == CloseFrame.PROTOCOL_ERROR ) { // this endpoint found a PROTOCOL_ERROR
451+
flushAndClose( code, message, remote );
450452
} else {
451453
flushAndClose( CloseFrame.NEVER_CONNECTED, message, false );
452454
}
453-
if( code == CloseFrame.PROTOCOL_ERROR )// this endpoint found a PROTOCOL_ERROR
454-
flushAndClose( code, message, remote );
455455
readystate = READYSTATE.CLOSING;
456456
tmpHandshakeBytes = null;
457457
return;

0 commit comments

Comments
 (0)