aboutsummaryrefslogtreecommitdiffstats
path: root/research
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-29 07:17:36 +0100
committereunhhu <[email protected]>2026-09-29 07:17:36 +0100
commit7c6595c8a9229a2208ed5bd75b2dee249187923d (patch)
tree93997bffc769e645ace36519e5948553dddff833 /research
parentfcf7cdbe0a971825da0bb087383c60e714ab2be0 (diff)
downloadpure-7c6595c8a9229a2208ed5bd75b2dee249187923d.tar.gz
pure-7c6595c8a9229a2208ed5bd75b2dee249187923d.zip
Keep a link's two sides as state alone, the sockets and threads apart
link/link-protocol.h is the protocol with no socket, thread or clock of its own: packets and time in, packets out. link/link.h carries it over UDP as before. A sender starts small (8 flights, 16 records, a 4 KiB ring) so one thread can hold many. The transport's CPU a record is the same within 2% (five rounds each way, 61 B to 16 KiB). test-link runs both sides through a network of its own: loss, packets held back and doubled, failed saves, an idle sweep, and both sides starting again, every record applied once as sent.
Diffstat (limited to 'research')
-rw-r--r--research/experiments/019-idle-links/transport.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/research/experiments/019-idle-links/transport.c b/research/experiments/019-idle-links/transport.c
index c4c9de1..5827311 100644
--- a/research/experiments/019-idle-links/transport.c
+++ b/research/experiments/019-idle-links/transport.c
@@ -138,9 +138,9 @@ int main(int argc, char **argv) {
return 1;
unsigned port = ntohs(any.sin_port);
close(probe);
- if (!(listener = pure_link_listen(port, b, public_b, &(PureLinkHost){input_of, deliver, NULL}, error, sizeof(error))) ||
- !pure_link_allow(listener, "bench.ordered", public_a, error, sizeof(error)) ||
- !pure_link_serve(listener, error, sizeof(error)))
+ PureLinkReceiver *r = pure_link_receiver(b, public_b, &(PureLinkHost){input_of, deliver, NULL}, error, sizeof(error));
+ if (!r || !pure_link_allow(r, "bench.ordered", public_a, error, sizeof(error)) ||
+ !(listener = pure_link_listen(r, port, error, sizeof(error))) || !pure_link_serve(listener, error, sizeof(error)))
return fprintf(stderr, "transport: %s\n", error), 1;
char url[128];
snprintf(url, sizeof(url), "pure://127.0.0.1:%u/order", port);