From 578d0ab47f22e0185987ed3f8c091129985cec6e Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sun, 4 Oct 2026 10:06:41 +0100 Subject: Let a link's receiver find its streams' inputs again (017, stage 3) A stream finds its input once, when it is made; an app that starts again with another module may have the input at another number, of another shape, or none. pure_link_receiver_rebind marks the streams to inputs of a prefix stale: each finds its input again by name, with the fields it was laid out with, before its next delivery and at its sender's next packet, keeping what it holds; one none takes is refused as a new one would be. pure_link_listener_rebind asks it of the listener's thread. test-link's rebound case stops its app, starts it with the input at another number, then of another shape taken by name: all 3,000 records come once, in order (without the rebind, none after the stop). --- link/link-protocol.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'link/link-protocol.h') diff --git a/link/link-protocol.h b/link/link-protocol.h index feff543..4f263b2 100644 --- a/link/link-protocol.h +++ b/link/link-protocol.h @@ -278,6 +278,12 @@ void pure_link_receiver_take(PureLinkReceiver *, const unsigned char *packet, si * go. */ void pure_link_receiver_turn(PureLinkReceiver *, const PureLinkDone *done, size_t count, uint64_t now, PureLinkSend *send, void *context); +/* The host's inputs whose names begin with prefix may be others now (an app + * started again with another module): their streams find theirs again, by + * name and with the fields they were laid out with, before their next + * delivery, a delivery out first done; what they hold stays. One no input + * takes now is refused at its sender's next packet, as a new one would be. */ +void pure_link_receiver_rebind(PureLinkReceiver *, const char *prefix); /* When a turn is due with no packet (ns), or 0 for none. */ uint64_t pure_link_receiver_due(const PureLinkReceiver *); void pure_link_receiver_counts(const PureLinkReceiver *, PureLinkCounts *); -- cgit v1.2.3