summaryrefslogtreecommitdiff
path: root/ext/http/01_http.js
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2022-05-23 13:21:11 +0200
committerGitHub <noreply@github.com>2022-05-23 13:21:11 +0200
commit3c97bbe165ef0c5e4fa9b9eb637ff481d8c86884 (patch)
tree750c15354bda8c535cdc4db95d26b19e01ed848d /ext/http/01_http.js
parentd55444b41cdee5b3f281896a7e60ff06c5fc01de (diff)
fix(ext/websocket): WebSocket dispatch single close event (#13443)
Diffstat (limited to 'ext/http/01_http.js')
-rw-r--r--ext/http/01_http.js36
1 files changed, 11 insertions, 25 deletions
diff --git a/ext/http/01_http.js b/ext/http/01_http.js
index c9fe8220d..de546285d 100644
--- a/ext/http/01_http.js
+++ b/ext/http/01_http.js
@@ -357,32 +357,18 @@
httpConn.close();
- if (ws[_readyState] === WebSocket.CLOSING) {
- await core.opAsync("op_ws_close", wsRid);
-
- ws[_readyState] = WebSocket.CLOSED;
-
- const errEvent = new ErrorEvent("error");
- ws.dispatchEvent(errEvent);
-
- const event = new CloseEvent("close");
- ws.dispatchEvent(event);
-
- core.tryClose(wsRid);
- } else {
- ws[_readyState] = WebSocket.OPEN;
- const event = new Event("open");
- ws.dispatchEvent(event);
-
- ws[_eventLoop]();
- if (ws[_idleTimeoutDuration]) {
- ws.addEventListener(
- "close",
- () => clearTimeout(ws[_idleTimeoutTimeout]),
- );
- }
- ws[_serverHandleIdleTimeout]();
+ ws[_readyState] = WebSocket.OPEN;
+ const event = new Event("open");
+ ws.dispatchEvent(event);
+
+ ws[_eventLoop]();
+ if (ws[_idleTimeoutDuration]) {
+ ws.addEventListener(
+ "close",
+ () => clearTimeout(ws[_idleTimeoutTimeout]),
+ );
}
+ ws[_serverHandleIdleTimeout]();
}
} finally {
if (SetPrototypeDelete(httpConn.managedResources, streamRid)) {