diff options
| author | eunhhu <[email protected]> | 2026-09-27 08:24:08 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-27 08:24:08 +0100 |
| commit | 5372d03b5968796515966e2cfc89628d6448f0c1 (patch) | |
| tree | 4ddefd226b2089aafdca06fd981ad3a17a37dbbf /prototypes/connections/module.c | |
| parent | ddff7e15d1d0e90a5f5a52fcc93828c8ef0bbd5c (diff) | |
| download | pure-5372d03b5968796515966e2cfc89628d6448f0c1.tar.gz pure-5372d03b5968796515966e2cfc89628d6448f0c1.zip | |
Look for new sends newest first, only as far back as they go
After each save the owner walked the whole outbox to find the sends
not yet queued, so a receiver long down made every save walk the
backlog. pure_app_outbox_newest visits saved sends newest first, and
the owner stops once every wired output reaches the number it queued
last, then queues what it found in order.
Diffstat (limited to 'prototypes/connections/module.c')
| -rw-r--r-- | prototypes/connections/module.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/prototypes/connections/module.c b/prototypes/connections/module.c index 5cb7f11..697e918 100644 --- a/prototypes/connections/module.c +++ b/prototypes/connections/module.c @@ -1668,6 +1668,13 @@ void pure_app_outbox(const PureApp *app, PureSentVisit visit, void *context) { } } +void pure_app_outbox_newest(const PureApp *app, PureSentVisit visit, void *context) { + for (size_t i = app->sent_durable; i-- > 0;) { + const struct PureSent *sent = &app->sent[i]; + if (!sent->trimmed && !visit(context, sent->output, sent->seq, (PureSpan){sent->payload, sent->size})) return; + } +} + void pure_app_trim(PureApp *app, uint32_t output, uint64_t through) { for (size_t i = 0; i < app->sent_durable; ++i) if (app->sent[i].output == output && app->sent[i].seq <= through && !app->sent[i].trimmed) { |
