fix incorrect closures with code 1011 Internal error (#450)

* fix incorrect closures with code 1011 Internal error

* enable IXWebSocketCloseTest
This commit is contained in:
ouwou 2023-03-30 03:45:29 +00:00 committed by GitHub
parent dc7b986e10
commit f184a7adef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -700,6 +700,7 @@ namespace ix
if (_readyState != ReadyState::CLOSING) if (_readyState != ReadyState::CLOSING)
{ {
// send back the CLOSE frame // send back the CLOSE frame
setReadyState(ReadyState::CLOSING);
sendCloseFrame(code, reason); sendCloseFrame(code, reason);
wakeUpFromPoll(SelectInterrupt::kCloseRequest); wakeUpFromPoll(SelectInterrupt::kCloseRequest);
@ -1072,7 +1073,10 @@ namespace ix
else if (ret <= 0) else if (ret <= 0)
{ {
closeSocket(); closeSocket();
setReadyState(ReadyState::CLOSED); if (_readyState != ReadyState::CLOSING)
{
setReadyState(ReadyState::CLOSED);
}
return false; return false;
} }
else else

View File

@ -24,14 +24,13 @@ set (TEST_TARGET_NAMES
# IXWebSocketBroadcastTest ## FIXME was depending on cobra / take a broadcast server from ws # IXWebSocketBroadcastTest ## FIXME was depending on cobra / take a broadcast server from ws
IXStrCaseCompareTest IXStrCaseCompareTest
IXExponentialBackoffTest IXExponentialBackoffTest
IXWebSocketCloseTest
) )
# Some unittest don't work on windows yet # Some unittest don't work on windows yet
# Windows without TLS does not have hmac yet # Windows without TLS does not have hmac yet
if (UNIX) if (UNIX)
list(APPEND TEST_TARGET_NAMES list(APPEND TEST_TARGET_NAMES
IXWebSocketCloseTest
# Fail on Windows in CI probably because the pathing is wrong and # Fail on Windows in CI probably because the pathing is wrong and
# some resource files cannot be found # some resource files cannot be found
IXHttpServerTest IXHttpServerTest