]> git.ipfire.org Git - thirdparty/asterisk.git/commit
chan_websocket: Use the channel's ability to poll fds for the websocket read.
authorGeorge Joseph <gjoseph@sangoma.com>
Tue, 30 Dec 2025 19:15:26 +0000 (12:15 -0700)
committerGeorge Joseph <gjoseph@sangoma.com>
Mon, 5 Jan 2026 14:49:20 +0000 (14:49 +0000)
commitebf811722ab8ce6e11332c4a8d233d4366df36fb
treef8e3346c635b2fd86c620c912a3be6d92c3ac560
parentd834e0432424444095a46e63f8f9b961f29ac347
chan_websocket: Use the channel's ability to poll fds for the websocket read.

We now add the websocket's file descriptor to the channel's fd array and let
it poll for data availability instead if having a dedicated thread that
does the polling. This eliminates the thread and allows removal of most
explicit locking since the core channel code will lock the channel to prevent
simultaneous calls to webchan_read, webchan_hangup, etc.

While we were here, the hangup code was refactored to use ast_hangup_with_cause
instead of directly queueing an AST_CONTROL_HANGUP frame.  This allows us
to set hangup causes and generate snapshots.

For a bit of extra debugging, a table of websocket close codes was added
to http_websocket.h with an accompanying "to string" function added to
res_http_websocket.c

Resolves: #1683
channels/chan_websocket.c
include/asterisk/http_websocket.h
res/res_http_websocket.c