aboutsummaryrefslogtreecommitdiffstats
path: root/link/link-protocol.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-29 16:41:24 +0100
committereunhhu <[email protected]>2026-09-29 16:41:24 +0100
commit3bd9b6c924c801dc5033510391ac251a7309219f (patch)
treed0465bb16850b822e4b2a09a73cf370993fd4f16 /link/link-protocol.h
parent590cbb9d0c73c9e48ac4a637c2e88a7e99c7965f (diff)
downloadpure-3bd9b6c924c801dc5033510391ac251a7309219f.tar.gz
pure-3bd9b6c924c801dc5033510391ac251a7309219f.zip
Take no send larger than a receiver holds: 16 MiB, not 64
A sender took sends up to 64 MiB, but a receiver holds 16 MiB of a stream not yet stored, so a send between the two went again forever. The most a send may be is now PURE_LINK_RECORD_MOST, what a receiver holds; test-link sends one that large whole and is refused one byte more.
Diffstat (limited to 'link/link-protocol.h')
-rw-r--r--link/link-protocol.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/link/link-protocol.h b/link/link-protocol.h
index 25ff12f..b9a3eeb 100644
--- a/link/link-protocol.h
+++ b/link/link-protocol.h
@@ -118,8 +118,11 @@
* goes back to the first size when the larger stop coming, ยง4.3); a
* source's or an input's name is 1 to PURE_LINK_NAME bytes; a receiver
* keeps a packet's path (where it came from, and the address of its own it
- * came to: link/link.c answers from there) in PURE_LINK_ADDRESS bytes. */
-enum { PURE_LINK_DATAGRAM = 1200, PURE_LINK_DATAGRAM_MOST = 1452, PURE_LINK_NAME = 64, PURE_LINK_ADDRESS = 48 };
+ * came to: link/link.c answers from there) in PURE_LINK_ADDRESS bytes; a
+ * send is PURE_LINK_RECORD_MOST bytes at most (what a receiver holds of a
+ * stream not yet stored). */
+enum { PURE_LINK_DATAGRAM = 1200, PURE_LINK_DATAGRAM_MOST = 1452, PURE_LINK_NAME = 64, PURE_LINK_ADDRESS = 48,
+ PURE_LINK_RECORD_MOST = 16 << 20 };
/* Counts for a host's report: packets and records sent, records sent again,
* packets lost and acknowledged, packets received, deliveries handed over,
@@ -150,7 +153,8 @@ bool pure_link_sender_peer(PureLinkSender *, const unsigned char peer[PURE_SEAL_
* a key kept in hardware, say, or a test's many keys): no X25519 here. */
bool pure_link_sender_shared(PureLinkSender *, const unsigned char peer[PURE_SEAL_KEY], const unsigned char secret[32]);
/* A saved send, numbered one past the last queued (any number when none
- * waits); false when it cannot be kept. */
+ * waits); false when it cannot be kept (or is larger than
+ * PURE_LINK_RECORD_MOST). */
bool pure_link_sender_queue(PureLinkSender *, uint64_t seq, const unsigned char *bytes, size_t size);
/* A packet that came (the receiver's answers; others are let be). */
void pure_link_sender_take(PureLinkSender *, const unsigned char *packet, size_t size, uint64_t now);