Commit Diff


commit - 8d9aeea2c909b41533ac80622b532f93657fb815
commit + a0ec9cd6ce94b26faa1ab2f4407e6b0d0d43045d
blob - 8c8ec7c513c627a32563450da7ea4622807fc12a
blob + c6cdf5586d0d1fdfafc4b4d381167e34885c01d4
--- gmid.h
+++ gmid.h
@@ -299,8 +299,7 @@ struct proxy_protocol_v1 {
 
 #define BUFLAYER_MAX 108
 
-struct buflayer
-{
+struct buflayer {
 	char data[BUFLAYER_MAX];
 	size_t len;
 	ssize_t read_pos;
@@ -309,17 +308,17 @@ struct buflayer
 
 struct client {
 	struct conf		*conf;
-	struct address	*addr;
-	int 		 	 should_buffer;
-	struct buflayer  buf;
-	uint32_t	 	 id;
+	struct address		*addr;
+	int 			 should_buffer;
+	struct buflayer		 buf;
+	uint32_t		 id;
 	struct tls		*ctx;
 	char			*req;
-	size_t		 	 reqlen;
-	struct iri	 	 iri;
-	char		 	 domain[DOMAIN_NAME_LEN];
-	char		 	 rhost[NI_MAXHOST];
-	char		 	 rserv[NI_MAXSERV];
+	size_t			 reqlen;
+	struct iri		 iri;
+	char			 domain[DOMAIN_NAME_LEN];
+	char			 rhost[NI_MAXHOST];
+	char			 rserv[NI_MAXSERV];
 
 	struct bufferevent *bev;
 
blob - f3e34f3ad580b73b4818c9e57ffe2643ac5b5008
blob + 69f358ab46252a0749527eb12dc3766f69ba9575
--- server.c
+++ server.c
@@ -1300,7 +1300,7 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, voi
 	struct client *c = cb_arg;
 
 	if (!c->should_buffer) {
-		// no buffer to cache into, read into libtls buffer
+		/* no buffer to cache into, read into libtls buffer */
 		errno = 0;
 		ssize_t ret = read(c->fd, buf, buflen);
 		if (ret == -1 && errno == EWOULDBLOCK)
@@ -1310,7 +1310,7 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, voi
 	}
 
 	if (c->buf.has_tail) {
-		// we have leftover data from a previous call to read_cb
+		/* we have leftover data from a previous call to read_cb */
 		size_t left = BUFLAYER_MAX - c->buf.read_pos;
 		size_t copy_len = MINIMUM(buflen, left);
 		memcpy(buf, c->buf.data + c->buf.read_pos, copy_len);
@@ -1318,7 +1318,6 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, voi
 		c->buf.read_pos += copy_len;
 
 		if (left == copy_len) {
-			// memset(buflayer, 0, BUFLAYER_MAX);
 			c->should_buffer = 0;
 			c->buf.has_tail = 0;
 		}
@@ -1326,7 +1325,7 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, voi
 		return copy_len;
 	}
 
-	// buffer layer exists, we expect proxy protocol
+	/* buffer layer exists, we expect proxy protocol */
 	ssize_t n_read = read(
 		c->fd, 
 		c->buf.data + c->buf.len, 
@@ -1369,11 +1368,11 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, voi
 	log_debug("proxy-protocol v1: %s", protostr);
 
 	if (consumed < c->buf.len) {
-		// we have some leftover
+		/* we have some leftover */
 		c->buf.read_pos = consumed;
 		c->buf.has_tail = 1;
 	} else {
-		// we consumed the whole buffer
+		/* we consumed the whole buffer */
 		c->should_buffer = c->buf.read_pos = 0;
 		c->buf.has_tail = 0;
 	}
@@ -1381,7 +1380,8 @@ read_cb(struct tls *ctx, void *buf, size_t buflen, voi
 	return TLS_WANT_POLLIN;
 }
 
-static ssize_t write_cb(struct tls *ctx, const void *buf, size_t buflen, void *cb_arg)
+static ssize_t
+write_cb(struct tls *ctx, const void *buf, size_t buflen, void *cb_arg)
 {
 	struct client *c = cb_arg;