tlsgate

TLS reverse proxy
git clone git://git.akobets.xyz/tlsgate
Log | Files | Refs | README | LICENSE

commit 215b014837347f60fe9a63effcad16c2231bc841
parent 1487a0cbc9bc156c308b3d1e7b61c8df8ba1636f
Author: Artem Kobets <artem@akobets.xyz>
Date:   Thu,  3 Sep 2020 13:03:06 +0300

logic fixes

Diffstat:
Mserve.c | 9++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/serve.c b/serve.c @@ -31,14 +31,12 @@ serve(struct tls *ctx, int fd) while (1) { char buf[BUFMAX]; ssize_t nread; - int ret; nread = read(fd, buf, sizeof(buf)); if (nread == -1 || nread == 0) break; - ret = full_tls_write(ctx, buf, nread); - if (ret == -1) + if (full_tls_write(ctx, buf, nread) == -1); break; } @@ -49,7 +47,6 @@ serve(struct tls *ctx, int fd) while (1) { char buf[BUFMAX]; ssize_t nread; - int ret; while (1) { nread = tls_read(ctx, buf, sizeof(buf)); @@ -65,8 +62,7 @@ serve(struct tls *ctx, int fd) if (nread == -1 || nread == 0) break; - ret = full_write(fd, buf, nread); - if (ret == -1) + if (full_write(fd, buf, nread) == -1) break; } @@ -126,7 +122,6 @@ full_tls_write(struct tls *ctx, char *buf, ssize_t len) ) { continue; } else { - break; len -= nwritten; buf += nwritten; }