summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/conn-tools/s6-tcpserverd.c2
-rw-r--r--src/sbearssl/sbearssl_run.c15
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))