summaryrefslogtreecommitdiff
path: root/yhttpd/src/tool
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-30 10:56:26 +0300
committerPaul Buetow <paul@buetow.org>2026-06-30 10:56:26 +0300
commit870459fa00ee203b7e763b6c8197ac3955692015 (patch)
tree98cff50c5d6a59a183dbeacacc98ef59df14da5c /yhttpd/src/tool
parent2adb923d328d7a9a5fb6618269cd42d2cd692a84 (diff)
Reimplement the streaming chat-display layer
The message-delivery layer was gutted (user::msg_post commented out; set_context/_send referenced only in comments, never defined), so the chat could log in but never show or send messages: the stream frame returned an empty response (502 behind Traefik) and posted messages went nowhere. Reimplemented server-streamed chat: - user: add i_stream_fd (long-lived chat-display connection) + b_stream_ready + s_msg buffer. msg_post appends to s_msg and flushes to the fd once the initial response is sent (best-effort non-blocking write; buffer on EAGAIN; on hard write error drop the reference and mark offline). flush_stream/clear_stream helpers; clear_stream on clean()/disconnect. - reqp (event=stream): build the initial HTTP response (headers, no Content-Length so it streams incrementally, + the parsed stream.html body), attach this fd to the user, set p_context->p_user, KEEP_ALIVE=yes. - sock: route KEEP_ALIVE responses through handle_stream_write (sends the initial page, then arms a persistent read event) and handle_stream_read (drains stray bytes; on EOF/error reaps the context and clears the user's stream). The connection stays open for pushed messages. - context: init p_user=NULL; track i_buf_len across reads (POST body behind a proxy arrives in a separate segment). Verified locally: login -> open stream -> post message -> message appears in the stream; two users in a room both receive a posted message.
Diffstat (limited to 'yhttpd/src/tool')
0 files changed, 0 insertions, 0 deletions