diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-11-19 03:05:39 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-11-19 03:05:39 +0000 |
commit | 8fe924c3da6ab919f512029a15464e77cbeede8a (patch) | |
tree | 2b66be3ffe064f98621f8d2c10214a3e001ca19f /src | |
parent | 06b1f4f397d53e9a4c9abe4c8c4c20a7240e7736 (diff) | |
download | s6-networking-8fe924c3da6ab919f512029a15464e77cbeede8a.tar.xz |
Small bugfixes, update deps, update doc
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/conn-tools/s6-tcpserverd.c | 2 | ||||
-rw-r--r-- | src/sbearssl/sbearssl_run.c | 15 |
2 files changed, 7 insertions, 10 deletions
diff --git a/src/conn-tools/s6-tcpserverd.c b/src/conn-tools/s6-tcpserverd.c index 5b35301..e8c2c34 100644 --- a/src/conn-tools/s6-tcpserverd.c +++ b/src/conn-tools/s6-tcpserverd.c @@ -122,7 +122,7 @@ static inline void log_reject (char const *ip, uint16_t port, uint32_t num) fmtip[is6 ? ip6_fmt(fmtip, ip) : ip4_fmt(fmtip, ip)] = 0 ; fmtport[uint16_fmt(fmtport, port)] = 0 ; fmtnum[uint32_fmt(fmtnum, num)] = 0 ; - strerr_warni7sys("reject ", fmtip, "_", fmtport, " count ", fmtnum, fmtlocalmaxconn) ; + strerr_warni7x("reject ", fmtip, "_", fmtport, " count ", fmtnum, fmtlocalmaxconn) ; } static inline void log_accept (pid_t pid, char const *ip, uint16_t port, uint32_t num) diff --git a/src/sbearssl/sbearssl_run.c b/src/sbearssl/sbearssl_run.c index 9f59302..af8b10e 100644 --- a/src/sbearssl/sbearssl_run.c +++ b/src/sbearssl/sbearssl_run.c @@ -33,20 +33,19 @@ void sbearssl_run (br_ssl_engine_context *ctx, int *fd, tain const *tto, uint32_ int handshake_done = 0 ; int closing = 0 ; tain deadline ; + tain_add_g(&deadline, tto) ; if (ndelay_on(fd[0]) == -1 || ndelay_on(fd[1]) == -1 || ndelay_on(fd[2]) == -1 || ndelay_on(fd[3]) == -1) strerr_diefu1sys(111, "set fds non-blocking") ; - tain_add_g(&deadline, tto) ; - while (fd[0] >= 0 || fd[1] >= 0 || fd[3] >= 0) + while ((fd[0] >= 0 || fd[1] >= 0 || fd[3] >= 0) && !(state & BR_SSL_CLOSED)) { uint8_t y[4] ; uint8_t j = 0 ; - /* Preparation */ if (fd[0] >= 0 && state & BR_SSL_SENDAPP) @@ -64,10 +63,10 @@ void sbearssl_run (br_ssl_engine_context *ctx, int *fd, tain const *tto, uint32_ } else y[0] = 4 ; - if (fd[1] >= 0 && state & BR_SSL_RECVAPP) + if (fd[1] >= 0) { x[j].fd = fd[1] ; - x[j].events = IOPAUSE_WRITE ; + x[j].events = state & BR_SSL_RECVAPP ? IOPAUSE_WRITE : 0 ; y[1] = j++ ; } else y[1] = 4 ; @@ -80,16 +79,14 @@ void sbearssl_run (br_ssl_engine_context *ctx, int *fd, tain const *tto, uint32_ } else y[2] = 4 ; - if (fd[3] >= 0 && state & BR_SSL_SENDREC) + if (fd[3] >= 0) { x[j].fd = fd[3] ; - x[j].events = IOPAUSE_WRITE ; + x[j].events = state & BR_SSL_SENDREC ? IOPAUSE_WRITE : 0 ; y[3] = j++ ; } else y[3] = 4 ; - if (!j) break ; - /* Wait for events */ switch (iopause_g(x, j, &deadline)) |