Skip to content

Commit f184a7a

Browse files
authored
fix incorrect closures with code 1011 Internal error (#450)
* fix incorrect closures with code 1011 Internal error * enable IXWebSocketCloseTest
1 parent dc7b986 commit f184a7a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ixwebsocket/IXWebSocketTransport.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ namespace ix
700700
if (_readyState != ReadyState::CLOSING)
701701
{
702702
// send back the CLOSE frame
703+
setReadyState(ReadyState::CLOSING);
703704
sendCloseFrame(code, reason);
704705

705706
wakeUpFromPoll(SelectInterrupt::kCloseRequest);
@@ -1072,7 +1073,10 @@ namespace ix
10721073
else if (ret <= 0)
10731074
{
10741075
closeSocket();
1075-
setReadyState(ReadyState::CLOSED);
1076+
if (_readyState != ReadyState::CLOSING)
1077+
{
1078+
setReadyState(ReadyState::CLOSED);
1079+
}
10761080
return false;
10771081
}
10781082
else

test/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@ set (TEST_TARGET_NAMES
2424
# IXWebSocketBroadcastTest ## FIXME was depending on cobra / take a broadcast server from ws
2525
IXStrCaseCompareTest
2626
IXExponentialBackoffTest
27+
IXWebSocketCloseTest
2728
)
2829

2930
# Some unittest don't work on windows yet
3031
# Windows without TLS does not have hmac yet
3132
if (UNIX)
3233
list(APPEND TEST_TARGET_NAMES
33-
IXWebSocketCloseTest
34-
3534
# Fail on Windows in CI probably because the pathing is wrong and
3635
# some resource files cannot be found
3736
IXHttpServerTest

0 commit comments

Comments
 (0)