From 5f5603ce239dce08ae2ec4b0fa828787b220493c Mon Sep 17 00:00:00 2001 From: eunhhu Date: Thu, 1 Oct 2026 09:10:55 +0100 Subject: 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). --- link/crypto.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'link/crypto.h') diff --git a/link/crypto.h b/link/crypto.h index ede5fb9..4d3fff0 100644 --- a/link/crypto.h +++ b/link/crypto.h @@ -8,15 +8,17 @@ * first time a server seals, opens a seal or connects to an https receiver * (link/crypto.c): one that does none of these maps no OpenSSL, 2.3 MiB * less resident and 0.6 MiB less of its own. */ -enum { PURE_CRYPTO_VERSION = 5 }; +enum { PURE_CRYPTO_VERSION = 6 }; typedef struct { unsigned version; /* TLS client: the context (verifying against ca_file, or the system's - * CAs when NULL), sessions over connected sockets, their reads and - * writes (as SSL_read and SSL_write: bytes, or <= 0), and their end. */ + * CAs when NULL), sessions over connected non-blocking sockets, their + * handshakes' steps, reads and writes (as link/tls.h says), and their + * end. */ bool (*tls_start)(const char *ca_file); PureTls *(*tls_open)(const char *host, int fd); + int (*tls_step)(PureTls *); int (*tls_read)(PureTls *, void *bytes, int size); int (*tls_write)(PureTls *, const void *bytes, int size); void (*tls_close)(PureTls *); -- cgit v1.2.3