Skip to main content
ALT Linux Bugzilla
– Attachment 23017 Details for
Bug 61660
WebSocket-соединение разрывается спустя несколько секунд при использовании freeswitch-webui
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
FreeSWITCH: WebSocket (v2)
freeswitch-61660-v2.patch (text/plain), 3.34 KB, created by
Anton Farygin
on 2026-11-26 07:14:00 MSK
(
hide
)
Description:
FreeSWITCH: WebSocket (v2)
Filename:
MIME Type:
Creator:
Anton Farygin
Created:
2026-11-26 07:14:00 MSK
Size:
3.34 KB
patch
obsolete
>From e7a58b9d008a8a9c00c0e33d02ec1639a6007cc6 Mon Sep 17 00:00:00 2001 >From: Anton Farygin <rider@altlinux.org> >Date: Wed, 25 Nov 2026 19:11:54 +0500 >Subject: [PATCH] fix(mod_xml_rpc): keep idle WebSocket connections open > >Abyss times out reads after two seconds, including on healthy >connections with no traffic. The frame reader treated an idle timeout as >a protocol error and disconnected the portal after about four seconds. >Retry only between frames; a timeout on a partial frame and an actual >read error still end the connection. >--- > src/mod/xml_int/mod_xml_rpc/ws.c | 22 +++++++++++++++++----- > src/mod/xml_int/mod_xml_rpc/ws.h | 1 - > 2 files changed, 17 insertions(+), 6 deletions(-) > >diff --git a/src/mod/xml_int/mod_xml_rpc/ws.c b/src/mod/xml_int/mod_xml_rpc/ws.c >index bb9c22e8ba..a16ec36ce3 100644 >--- a/src/mod/xml_int/mod_xml_rpc/ws.c >+++ b/src/mod/xml_int/mod_xml_rpc/ws.c >@@ -263,7 +263,7 @@ int ws_handshake_kvp(wsh_t *wsh, char *key, char *version, char *proto) > > } > >-issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes) >+static issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, bool *timed_out) > { > issize_t r; > TConn *conn = wsh->tsession->connP; >@@ -285,7 +285,7 @@ issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes) > printf("286 Read Error %d!\n", r); > return 0; > } else if (r == 0) { >- ConnRead(conn, 2, NULL, NULL, &readError); >+ ConnRead(conn, 2, NULL, timed_out, &readError); > > if (readError) { > // printf("292 Read Error %s\n", readError); >@@ -415,6 +415,7 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) > > issize_t need = 2; > char *maskp; >+ bool timed_out; > > again: > need = 2; >@@ -429,9 +430,20 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) > return ws_close(wsh, WS_PROTO_ERR); > } > >- if ((wsh->datalen = ws_raw_read(wsh, wsh->buffer, 14)) < need) { >+ /* Idle between frames is normal; a stalled partial frame still fails. */ >+ do { >+ timed_out = false; >+ wsh->datalen = ws_raw_read(wsh, wsh->buffer, 14, &timed_out); >+ } while (timed_out && !wsh->down); >+ >+ if (wsh->down) { >+ *oc = WSOC_CLOSE; >+ return -1; >+ } >+ >+ if (wsh->datalen < need) { > while (!wsh->down && wsh->datalen < need) { >- issize_t r = ws_raw_read(wsh, wsh->buffer + wsh->datalen, 14 - wsh->datalen); >+ issize_t r = ws_raw_read(wsh, wsh->buffer + wsh->datalen, 14 - wsh->datalen, NULL); > > if (r < 1) { > /* invalid read - protocol err .. */ >@@ -536,7 +548,7 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) > wsh->rplen = wsh->plen - need; > > while(need) { >- issize_t r = ws_raw_read(wsh, wsh->payload + wsh->rplen, need); >+ issize_t r = ws_raw_read(wsh, wsh->payload + wsh->rplen, need, NULL); > > if (r < 1) { > /* invalid read - protocol err .. */ >diff --git a/src/mod/xml_int/mod_xml_rpc/ws.h b/src/mod/xml_int/mod_xml_rpc/ws.h >index eda49b20e7..bfd80219e0 100644 >--- a/src/mod/xml_int/mod_xml_rpc/ws.h >+++ b/src/mod/xml_int/mod_xml_rpc/ws.h >@@ -78,7 +78,6 @@ issize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc); > issize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes); > > >-issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes); > issize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes); > issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data); > issize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes); >-- >2.50.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 61660
:
22999
|
23000
|
23012
| 23017