This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch tymux-10-quiet-head
in repository terminology.

View the commit online.

commit f2761fe987eb5a9609951cf61186ee45f19a949c
Author: Cedric BAIL <[email protected]>
AuthorDate: Wed Nov 18 21:39:11 2026 -0600

    termd_tymux: keep the line that triggers a backlog flush
    
    When a backlog line did not fit in the pending TSRV_MSG_BACKLOG payload,
    the flush freed the pending buffer and the line was then appended to
    the NULL buffer, which silently drops it. A client watching `seq 1 3000`
    lost one line per 64K message while a client attaching afterwards,
    served from the daemon's own backlog, saw them.
    
    Create the buffer again after the flush. The new check of tests/tymux.py
    streams `seq 201 3200` to a raw client and misses lines 1331 and 2295
    without this change.
---
 src/bin/termd_tymux.c |  7 ++++++-
 tests/tymux.py        | 17 +++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/src/bin/termd_tymux.c b/src/bin/termd_tymux.c
index ef1807cb..2190cdf7 100644
--- a/src/bin/termd_tymux.c
+++ b/src/bin/termd_tymux.c
@@ -355,7 +355,12 @@ _cb_pty_backlog(void *data, Termpty *ty EINA_UNUSED, const Termcell *cells, ssiz
    if (need > TERMSRV_MAX_MSG_PAYLOAD)
      return;
    if (off + need > TERMSRV_MAX_MSG_PAYLOAD)
-     _backlog_pending_flush(td);
+     {
+        _backlog_pending_flush(td);
+        td->backlog_pending = eina_binbuf_new();
+        if (!td->backlog_pending)
+          return;
+     }
 
    eina_binbuf_append_length(td->backlog_pending,
                              (const unsigned char *)&cols, sizeof(cols));
diff --git a/tests/tymux.py b/tests/tymux.py
index 823299f1..7b956b76 100644
--- a/tests/tymux.py
+++ b/tests/tymux.py
@@ -418,6 +418,23 @@ def main():
     check("101" in seen_after_attach,
           "backlog: lines that scroll off after attach are streamed too")
 
+    # a flood needs several BACKLOG messages: the line that does not fit
+    # in the one being filled starts the next, it is not lost
+    b.send("seq 201 3200\r")
+    streamed = set()
+    end = time.time() + 20
+    while time.time() < end and "3170" not in streamed:
+        got = recv_msg(raw, buf, timeout=max(0.1, end - time.time()))
+        if got is None:
+            break
+        mtype, payload = got
+        if mtype == 12:
+            streamed.update(backlog_lines(payload))
+    missing = [n for n in range(201, 3171) if str(n) not in streamed]
+    check(not missing,
+          "backlog: no line is lost between two streamed messages"
+          " (%d missing, first %s)" % (len(missing), missing[:3]))
+
     raw.close()
     tymux("kill", NAME4)
     check(b.wait() is not None, "backlog: killing the session detaches it")

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to