diff options
| author | eunhhu <[email protected]> | 2026-10-01 09:10:55 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-10-01 09:10:55 +0100 |
| commit | 5f5603ce239dce08ae2ec4b0fa828787b220493c (patch) | |
| tree | 04c77f6202f0de2ac61ccc3d58cdf54e790b9165 /serve/deliver.h | |
| parent | 2128089d94a9a7345775e2725347713a66987039 (diff) | |
| download | pure-5f5603ce239dce08ae2ec4b0fa828787b220493c.tar.gz pure-5f5603ce239dce08ae2ec4b0fa828787b220493c.zip | |
Deliver wires on the sending loop, a step at a time (017, 2b-2)
A wire is now a sender of link/sending.h: its request goes on a
non-blocking socket as far as the socket takes it (connect, TLS
handshake, write, answer read), and its round waits for the socket or
its deadline (10 s with nothing moved). The answer is read as it comes:
the head whole, then a sized body counted down, a chunked one (few and
small) parsed again as it grows, or a body to the close. The crypto
table (version 6) takes the TLS handshake a step at a time, and reads
and writes say what they wait for. The owner pushes a wire once a turn,
as it does a link. A host whose app sends to ten links and ten wires
has 5 threads where it had 24 (none: 3).
Diffstat (limited to 'serve/deliver.h')
| -rw-r--r-- | serve/deliver.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/serve/deliver.h b/serve/deliver.h index 244363a..40f1e4c 100644 --- a/serve/deliver.h +++ b/serve/deliver.h @@ -32,15 +32,20 @@ uint32_t pure_wire_output(const PureWire *); void pure_wire_seal(PureWire *, const unsigned char peer[32], const PureSealKey *own, const unsigned char *from); /* The owner's side: queue a saved send numbered after the last queued one * (it is encoded now); false when it cannot be (a bytes field that is not - * UTF-8 has no JSON form), and the wire then stops at it. */ + * UTF-8 has no JSON form), and the wire then stops at it. What was queued + * goes once pushed, so a turn's sends go together. */ bool pure_wire_queue(PureWire *, uint64_t seq, PureSpan payload); +void pure_wire_push(PureWire *); uint64_t pure_wire_queued(const PureWire *); /* The last number delivered; any thread. */ uint64_t pure_wire_delivered(PureWire *); /* The bytes of the sends queued and not yet delivered (their JSON, and the * payloads kept for answers); any thread. */ size_t pure_wire_held(PureWire *); -/* Deliver on a thread of the wire's own, calling notify after each delivery. */ +/* Deliver on the process's sending loop (link/sending.h), calling notify + * (on its thread) after each delivery. A request goes on a non-blocking + * socket, a step at a time as it is ready; a receiver's name is looked up + * (DNS) where it connects, and the loop waits for it. */ bool pure_wire_start(PureWire *, void (*notify)(void *), void *context); /* Stop (a delivery under way is finished or abandoned) and free. */ void pure_wire_close(PureWire *); |
