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 c5b50ec26313a38623f4a1e5e0261b2eda1930b7
Author: Cedric BAIL <[email protected]>
AuthorDate: Fri Nov 20 02:50:18 2026 -0600
termtymux: ask again for the pages a short map reply left out
The daemon clips a MAP reply to the payload size. The pages it did not
cover keep their asked flag, and the view only released them when the
reply stored something. When every covered page was mapped already,
nothing was stored, so the rest of the range waited for the next NOTIFY
or viewport move.
Count a reply that covered at least one page as progress. A reply that
covered none, empty or malformed, still waits.
---
src/bin/backlog_view.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++--
src/bin/backlog_view.h | 2 +
src/bin/tytest.c | 2 +
src/bin/unit_tests.h | 2 +
4 files changed, 122 insertions(+), 5 deletions(-)
diff --git a/src/bin/backlog_view.c b/src/bin/backlog_view.c
index 686711d4..8c378c86 100644
--- a/src/bin/backlog_view.c
+++ b/src/bin/backlog_view.c
@@ -678,6 +678,8 @@ _pages_map_request(BacklogView *view)
count = (uint32_t)(hi - lo + 1);
/* the source may answer before it returns */
view->map_pending = EINA_TRUE;
+ view->map_first = first;
+ view->map_count = count;
_pages_map_asked_set(view, first, count, EINA_TRUE);
if (!view->src.map_request(view->data, first, count))
{
@@ -866,19 +868,24 @@ backlog_view_map_set(BacklogView *view, const void *payload, uint32_t size)
TermSrvMsgBacklogMapReq echo = { 0, 0 };
uint32_t off = sizeof(echo), id, num, k;
const uint32_t *widths;
- Eina_Bool stored = EINA_FALSE;
+ Eina_Bool was_pending, echo_ok, echoed = EINA_FALSE, stored = EINA_FALSE;
unsigned int i;
EINA_SAFETY_ON_NULL_RETURN(view);
+ was_pending = view->map_pending;
view->map_pending = EINA_FALSE;
view->settled = 0;
if (size >= sizeof(echo))
memcpy(&echo, payload, sizeof(echo));
+ echo_ok = was_pending && echo.first_page_id == view->map_first &&
+ echo.count >= 1 && echo.count <= view->map_count;
while (termsrv_backlog_map_page_next(payload, size, &off, &id, &num,
&widths) > 0)
{
BacklogViewPage *page = backlog_view_page_find(view, id);
+ if (id - echo.first_page_id < echo.count)
+ echoed = EINA_TRUE;
/* the head is followed through its mapping */
if (!page || page->mapped || page->widths ||
_page_is_head(view, page))
@@ -892,10 +899,23 @@ backlog_view_map_set(BacklogView *view, const void *payload, uint32_t size)
stored = EINA_TRUE;
}
/* A reply that stopped short of the range asked for is followed by a
- * request for the rest, as long as it brought something: pages it did
- * not cover otherwise wait for the next range or viewport move. Pages
- * that sealed while it was on its way were never asked for. */
- if (stored)
+ * request for the rest, as long as it covered a page of it, stored or
+ * not: the pages it left out otherwise wait for the next range or
+ * viewport move. Each such request starts after the previous echo, so
+ * they are bounded by the page count. A reply that does not echo the
+ * range asked for only counts if it stored something. */
+ if (echo_ok && echoed)
+ {
+ uint32_t from = echo.first_page_id + echo.count;
+ uint32_t span = view->map_first + view->map_count - from;
+
+ for (i = 0; i < view->pages_count; i++)
+ {
+ if (view->pages[i].id - from < span)
+ view->pages[i].map_asked = EINA_FALSE;
+ }
+ }
+ else if (stored)
{
for (i = 0; i < view->pages_count; i++)
{
@@ -1476,6 +1496,97 @@ tytest_backlog_view_map_again(void)
return 0;
}
+/* Test: a map reply that stopped short and stored nothing, as every page
+ * it covered was mapped already, is still followed by a request for the
+ * pages it left out. */
+int
+tytest_backlog_view_map_short(void)
+{
+ const uint32_t w[] = { 1 };
+ TermSrvMsgBacklogMapReq echo = { 0, 4 };
+ _Atomic uint32_t widths[] = { 1 };
+ unsigned char map[128];
+ uint32_t off = sizeof(echo), id;
+ Termpty *ty = _test_pty_new(10, 2, 32);
+ Test_Source src;
+ BacklogView *view = _test_view_new(ty, &src);
+
+ src.connected = EINA_TRUE;
+ _pages_range_set(view, 0, 11);
+ assert(_test_sent(&src.map_requests) == 1);
+ assert(src.map_first == 0 && src.map_count == 10);
+ for (id = 0; id < 4; id++)
+ _test_page_attach(&view->pages[id], _test_page_new(id, 1, w, 'a'));
+
+ memcpy(map, &echo, sizeof(echo));
+ for (id = 0; id < 4; id++)
+ assert(termsrv_backlog_map_page_append(map, sizeof(map), &off, id, 1,
+ widths) == 0);
+ _test_map_set(view, map, off);
+ assert(_test_sent(&src.map_requests) == 1);
+ assert(src.map_first == 4 && src.map_count == 6);
+
+ _test_view_free(view, ty);
+ return 0;
+}
+
+/* Test: a map reply that does not echo the range asked for, or one that
+ * keeps echoing the same start, does not make the view ask again and again:
+ * only an echo that advances does. */
+int
+tytest_backlog_view_map_echo(void)
+{
+ const uint32_t w[] = { 1 };
+ _Atomic uint32_t widths[] = { 1 };
+ const TermSrvMsgBacklogMapReq echos[] = { { 0, 4 }, { 0, 0 }, { 20, 3 } };
+ unsigned char map[128];
+ uint32_t off, id;
+ unsigned int e;
+ Termpty *ty = _test_pty_new(10, 2, 32);
+ Test_Source src;
+ BacklogView *view = _test_view_new(ty, &src);
+
+ src.connected = EINA_TRUE;
+ _pages_range_set(view, 0, 11);
+ assert(_test_sent(&src.map_requests) == 1);
+ for (id = 0; id < 4; id++)
+ _test_page_attach(&view->pages[id], _test_page_new(id, 1, w, 'a'));
+
+ /* the first echo advances: the rest is asked for */
+ for (e = 0; e < 3; e++)
+ {
+ off = sizeof(echos[e]);
+ memcpy(map, &echos[e], sizeof(echos[e]));
+ for (id = 0; id < 4; id++)
+ assert(termsrv_backlog_map_page_append(map, sizeof(map), &off, id,
+ 1, widths) == 0);
+ _test_map_set(view, map, off);
+ if (e == 0)
+ {
+ assert(_test_sent(&src.map_requests) == 1);
+ assert(src.map_first == 4 && src.map_count == 6);
+ }
+ else
+ assert(_test_sent(&src.map_requests) == 0);
+ /* the same start again: nothing new */
+ assert(view->pages[5].map_asked);
+ }
+ /* a reply echoing the start again, while the rest is out, is not an
+ * advance, however often it comes */
+ for (e = 0; e < 3; e++)
+ {
+ off = sizeof(echos[0]);
+ memcpy(map, &echos[0], sizeof(echos[0]));
+ assert(termsrv_backlog_map_page_append(map, sizeof(map), &off, 0, 1,
+ widths) == 0);
+ _test_map_set(view, map, off);
+ assert(_test_sent(&src.map_requests) == 0);
+ }
+
+ _test_view_free(view, ty);
+ return 0;
+}
+
/* Test: a map reply that brings nothing, an empty or a malformed one, is
* not followed by another map request before the next range. */
int
diff --git a/src/bin/backlog_view.h b/src/bin/backlog_view.h
index b73a3ec5..49976e5d 100644
--- a/src/bin/backlog_view.h
+++ b/src/bin/backlog_view.h
@@ -72,6 +72,8 @@ struct tag_BacklogView
uint32_t page_pending_id;
Eina_Bool page_pending; /* a page request waits */
Eina_Bool map_pending; /* a map request waits */
+ uint32_t map_first; /* its first page id */
+ uint32_t map_count; /* and its page count */
Eina_Bool source_lost; /* nothing is asked or released */
Eina_Bool changed; /* entries changed since the last
* backlog_view_sync() */
diff --git a/src/bin/tytest.c b/src/bin/tytest.c
index fde8186f..8bb76abd 100644
--- a/src/bin/tytest.c
+++ b/src/bin/tytest.c
@@ -187,6 +187,8 @@ static struct {
{ "backlog_view_ring_full", tytest_backlog_view_ring_full},
{ "backlog_view_map_again", tytest_backlog_view_map_again},
{ "backlog_view_map_empty", tytest_backlog_view_map_empty},
+ { "backlog_view_map_short", tytest_backlog_view_map_short},
+ { "backlog_view_map_echo", tytest_backlog_view_map_echo},
{ "backlog_view_pending_evicted", tytest_backlog_view_pending_evicted},
{ "backlog_view_page_refused", tytest_backlog_view_page_refused},
{ "backlog_view_map_head", tytest_backlog_view_map_head},
diff --git a/src/bin/unit_tests.h b/src/bin/unit_tests.h
index fc88f9b2..65ab529b 100644
--- a/src/bin/unit_tests.h
+++ b/src/bin/unit_tests.h
@@ -142,6 +142,8 @@ int tytest_backlog_view_sync(void);
int tytest_backlog_view_ring_full(void);
int tytest_backlog_view_map_again(void);
int tytest_backlog_view_map_empty(void);
+int tytest_backlog_view_map_short(void);
+int tytest_backlog_view_map_echo(void);
int tytest_backlog_view_pending_evicted(void);
int tytest_backlog_view_page_refused(void);
int tytest_backlog_view_map_head(void);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.