aboutsummaryrefslogtreecommitdiffstats
path: root/link/link-protocol.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-30 03:03:52 +0100
committereunhhu <[email protected]>2026-09-30 03:03:52 +0100
commitc9c0edf5a8fc9f79fff42064db09bc297e117a88 (patch)
treee8ca03f9f8af2c04726e78389559887b9d3cee4e /link/link-protocol.h
parentd1e8f38f100571d55aaa98527ae2873e6d247f80 (diff)
downloadpure-c9c0edf5a8fc9f79fff42064db09bc297e117a88.tar.gz
pure-c9c0edf5a8fc9f79fff42064db09bc297e117a88.zip
Let a receiver whose app is full keep what came, and say so
A link's delivery the app had no room for was handed over again at the next turn: a receiver over its memory budget would refuse the same records as fast as the owner could apply them. And its sender, seeing records received but not stored for a second, sent the whole window again every second. Now a host says a delivery found it full (PureLinkDone.full). The receiver keeps the records and hands them over again after a pause, 100 ms doubling to 500 ms, and meanwhile its STORED frames carry flag 2: the app is full and what came is kept. A sender hearing it starts its one-second wait for the save again, and sends none of it again. The spec (012) says both sides; the pause is a local choice that must stay under the sender's wait. pure_link_done takes the PureLinkDone itself. test-link's new case keeps the app full for 5 s: 12 hand-overs meanwhile, taken within 0.5 s of having room, and no record sent again (21,640 without the flag).
Diffstat (limited to 'link/link-protocol.h')
-rw-r--r--link/link-protocol.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/link/link-protocol.h b/link/link-protocol.h
index f131e99..96085c6 100644
--- a/link/link-protocol.h
+++ b/link/link-protocol.h
@@ -225,8 +225,11 @@ typedef struct {
void *context;
} PureLinkHost;
/* A delivery's end: heard, the last number heard; stored, its save
- * succeeded (else it is handed over again); gap, it stopped at a gap. */
-typedef struct { void *token; uint64_t heard; bool stored, gap; } PureLinkDone;
+ * succeeded (else it is handed over again); gap, it stopped at a gap; full,
+ * the host has no room for more now (its app's memory budget): what it did
+ * not take is kept, and handed over again after a pause, 100 ms doubling to
+ * half a second while it stays full (its sender told so meanwhile). */
+typedef struct { void *token; uint64_t heard; bool stored, gap, full; } PureLinkDone;
/* A packet to send to an address a packet came from: whether it went. */
typedef bool PureLinkSend(void *context, const unsigned char *packet, size_t size, const unsigned char *to,
size_t to_size);