aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2024-07-08 20:06:02 +0000
committerOmar Polo <op@omarpolo.com>2024-07-08 20:06:02 +0000
commit3bb8dcd1a8126baf8b9c731485fb2d664df1dd15 (patch)
tree75f678bba7f00b5f171857f91e5c3ef6c7784c3a
parenta0ec9cd6ce94b26faa1ab2f4407e6b0d0d43045d (diff)
s/should_buffer/proxy_proto
-rw-r--r--gmid.h2
-rw-r--r--server.c8
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);