fcd172f341
build / build (push) Has been cancelled
Two bugs when upstream closes: 1. Data loss: gatuna received CLOSE from gatunad and immediately RST'd the socket to curl while the drain pump still had queued payloads in _deliverChannel. Fix: OnRemoteClose() completes the channel writer and cancels the read pump, but lets the drain pump finish naturally. Drain pump no longer takes _cts.Token — it stops on channel completion and closes the socket gracefully (FIN, OS flushes in background). 2. Duplicate CLOSE: gatuna echoed CLOSE back to gatunad (server already knows — it initiated). SendClose() now guarded by _closeSent flag. OnRemoteClose() never sends CLOSE at all. Server-side: remove session from store before sending CLOSE so the retransmit timer stops before CLOSE is queued. Only log CLOSE if the session actually existed (dedup).