Commit40f59bb9Recorded14 Jul 2026Repositorysigil-irc
sigil-irc-websocket: document the genuine-close invariant in irc-ws-receive
Message
irc-ws-receive latches the session 'disconnected only on a genuine 'closed; that relies on (sigil websocket) ws-receive returning #f (not 'closed) while a browser socket is still in its async CONNECTING window. Comment-only; no behavior change.
Changed
packages/sigil-irc-websocket/src/sigil/irc/websocket.sgl | 8 ++++++++
1 file changed, 8 insertions(+)Diff
packages/sigil-irc-websocket/src/sigil/irc/websocket.sglmodified
@@ -577,6 +577,14 @@
577
(enqueue-message! session (ws-message-data message)) 578
(pop-message! session)) 579
#f))+580
;; Latch the session dead ONLY on a genuine close. This+581
;; relies on ws-receive returning #f (not 'closed) while a+582
;; browser socket is still in its async CONNECTING window+583
;; — otherwise the first poll during that window would+584
;; kill a connection that is merely opening slowly (the+585
;; browser slow-open bug fixed in (sigil websocket)+586
;; ws-receive). Do not relax that invariant without+587
;; distinguishing connecting from closed here too. 588
((eq? message 'closed) 589
(set-irc-ws-session-state! session 'disconnected) 590
'closed)