Commitda7eeaf2Recorded1 Sep 2026Repositorysigil-websocket
Keep native WebSocket nowait reads nonblocking
Changed
src/sigil/websocket/connection.sgl | 9 +++++++++
1 file changed, 9 insertions(+)Diff
src/sigil/websocket/connection.sglmodified
@@ -710,6 +710,15 @@
710
;; there. `receive-message` returns 'need-more on a 711
;; would-block read, which becomes #f here. 712
(and (current-scheduler)+713
;; A scheduler normally makes the socket nonblocking,+714
;; but NOWAIT must not rely on that ambient setup: a+715
;; caller may inherit a connection whose flag was not+716
;; retained by a wrapper/runtime boundary. For plain+717
;; TCP, readiness is the authoritative no-park gate.+718
;; TLS retains its own nonblocking state machine and+719
;; may have decrypted bytes buffered above the fd.+720
(or (tls-connection? (ws-connection-socket conn))+721
(socket-ready? (ws-connection-socket conn))) 722
(let ((result (receive-message conn))) 723
(cond 724
((ws-message? result) result)