From 3bb8dcd1a8126baf8b9c731485fb2d664df1dd15 Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Mon, 8 Jul 2024 20:06:02 +0000 Subject: s/should_buffer/proxy_proto --- gmid.h | 2 +- server.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gmid.h b/gmid.h index c6cdf55..2dc1ba1 100644 --- a/gmid.h +++ b/gmid.h @@ -309,7 +309,7 @@ struct buflayer { struct client { struct conf *conf; struct address *addr; - int should_buffer; + int proxy_proto; struct buflayer buf; uint32_t id; struct tls *ctx; diff --git a/server.c b/server.c index 69f358a..a8d1f06 100644 --- a/server.c +++ b/server.c @@ -1299,7 +1299,7 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, void *cb_arg) { struct client *c = cb_arg; - if (!c->should_buffer) { + if (!c->proxy_proto) { /* no buffer to cache into, read into libtls buffer */ errno = 0; ssize_t ret = read(c->fd, buf, buflen); @@ -1318,7 +1318,7 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, void *cb_arg) c->buf.read_pos += copy_len; if (left == copy_len) { - c->should_buffer = 0; + c->proxy_proto = 0; c->buf.has_tail = 0; } @@ -1373,7 +1373,7 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, void *cb_arg) c->buf.has_tail = 1; } else { /* we consumed the whole buffer */ - c->should_buffer = c->buf.read_pos = 0; + c->proxy_proto = c->buf.read_pos = 0; c->buf.has_tail = 0; } @@ -1422,7 +1422,7 @@ server_accept(int sock, short et, void *d) c->pfd = -1; memcpy(&c->raddr, &raddr, sizeof(raddr)); c->raddrlen = len; - c->should_buffer = addr->proxy; + c->proxy_proto = addr->proxy; e = getnameinfo(sraddr, len, c->rhost, sizeof(c->rhost), c->rserv, sizeof(c->rserv), NI_NUMERICHOST | NI_NUMERICSERV); -- cgit v1.2.3