BBS:      TELESC.NET.BR
Assunto:  src/ssh/TODO.md ssh-conn.c ssh-trans.c ssh-trans.h
De:       Deuc¨
Data:     Sat, 28 Mar 2026 12:55:04 -0700
-----------------------------------------------------------
https://gitlab.synchro.net/main/sbbs/-/commit/f7a7973a535c5b77c9a129b4
Modified Files:
	src/ssh/TODO.md ssh-conn.c ssh-trans.c ssh-trans.h
Log Message:
Close item 76: non-blocking demux sends via tx queue

send_packet() held tx_mtx for its entire duration including the blocking
gconf.tx() I/O callback.  On a congested link, the demux thread blocked
on tx_mtx for fire-and-forget protocol responses, stalling all incoming
packet processing.

The naive split (prepare under lock, I/O outside) doesn't work: SSH MACs
use implicit sequence numbers, so wire order must match assignment order.
Any split requires a second ordering mechanism that re-serializes I/O.

Instead, add a send queue: the demux thread uses mtx_trylock on tx_mtx --
fast path sends immediately, slow path enqueues the payload (linked list
under independent tx_queue_mtx).  send_packet() drains the queue before
each send, preserving sequence-number ordering.

Extracted send_packet_inner() for the core build/MAC/encrypt/I/O logic.
Three demux call sites changed to send_or_queue(): CHANNEL_FAILURE,
OPEN_FAILURE, and GLOBAL_REQUEST reply.

Co-Authored-By: Claude Opus 4.6 (1M context) 
n
---
  mSynchronetn  hgVertrauen n hHome of Synchronet n gh[vert/cvs/bbs].synchro.net

-----------------------------------------------------------
[Voltar]