summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--bounce.c6
-rw-r--r--bounce.h2
-rw-r--r--local.c22
3 files changed, 15 insertions, 15 deletions
diff --git a/bounce.c b/bounce.c
index f460d74..b0cdca2 100644
--- a/bounce.c
+++ b/bounce.c
@@ -480,9 +480,9 @@ int main(int argc, char *argv[]) {
 			}
 
 			if (!event.clients[i]) {
-				int fd;
-				struct tls *tls = localAccept(&fd, event.fds[i].fd);
-				if (!tls) {
+				struct tls *tls;
+				int fd = localAccept(&tls, event.fds[i].fd);
+				if (fd < 0) {
 					warn("accept");
 					continue;
 				}
diff --git a/bounce.h b/bounce.h
index a6ad31f..77e0164 100644
--- a/bounce.h
+++ b/bounce.h
@@ -171,7 +171,7 @@ void ringLoad(FILE *file);
 void localConfig(FILE *cert, FILE *priv, FILE *ca, bool require);
 size_t localBind(int fds[], size_t cap, const char *host, const char *port);
 size_t localUnix(int fds[], size_t cap, const char *path);
-struct tls *localAccept(int *fd, int bind);
+int localAccept(struct tls **tls, int bind);
 
 extern struct timeval serverQueueInterval;
 void serverConfig(bool insecure, const char *cert, const char *priv);
diff --git a/local.c b/local.c
index a697e15..21e7cb1 100644
--- a/local.c
+++ b/local.c
@@ -221,29 +221,29 @@ static int recvfd(int sock) {
 	return *(int *)CMSG_DATA(cmsg);
 }
 
-struct tls *localAccept(int *fd, int bind) {
-	*fd = accept(bind, NULL, NULL);
-	if (*fd < 0) return NULL;
+int localAccept(struct tls **client, int bind) {
+	int fd = accept(bind, NULL, NULL);
+	if (fd < 0) return fd;
 
 	if (unix) {
-		int sent = recvfd(*fd);
+		int sent = recvfd(fd);
 		if (sent < 0) err(EX_IOERR, "recvfd");
-		close(*fd);
-		*fd = sent;
+		close(fd);
+		fd = sent;
 	}
 
 	int on = 1;
-	int error = setsockopt(*fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
+	int error = setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on));
 	if (error) err(EX_OSERR, "setsockopt");
 
 #ifdef TCP_KEEPIDLE
 	int idle = 15 * 60;
-	error = setsockopt(*fd, IPPROTO_TCP, TCP_KEEPIDLE, &idle, sizeof(idle));
+	error = setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &idle, sizeof(idle));
 	if (error) err(EX_OSERR, "setsockopt");
 #endif
 
-	struct tls *client;
-	error = tls_accept_socket(server, &client, *fd);
+	error = tls_accept_socket(server, client, fd);
 	if (error) errx(EX_SOFTWARE, "tls_accept_socket: %s", tls_error(server));
-	return client;
+
+	return fd;
 }
le='2021-01-12 22:44:03 -0500'>2021-01-12Use hilex for bin HTMLJune McEnroe 2021-01-12Don't output a pre in hilex by defaultJune McEnroe 2021-01-12Move hilex out of hilex directoryJune McEnroe 2021-01-12Consolidate hilex formatters into hilex.cJune McEnroe 2021-01-12Remove hacky tagging from hilexJune McEnroe God that makes the lexers so much simpler. 2021-01-12Add htagml -iJune McEnroe 2021-01-12Render tag index in HTMLJune McEnroe 2021-01-12Add htagml -xJune McEnroe 2021-01-12Prevent matching the same tag twiceJune McEnroe 2021-01-12Process htagml file line by lineJune McEnroe This simplifies some things, adds support for line number tag definitions, and should enable combining htagml with other preprocessors in the future. 2021-01-12Split fields by tab onlyJune McEnroe Also don't fail hard on non-forward-search definitions. 2021-01-12List both Makefile and html.sh under README.7June McEnroe 2021-01-12Add htagml exampleJune McEnroe 2021-01-12Use mandoc and htagml for bin htmlJune McEnroe 2021-01-12Add htagmlJune McEnroe 2021-01-12Replace causal.agency with a simple mdoc pageJune McEnroe 2021-01-11Publish "Using vi"June McEnroe 2021-01-11Enable diff.colorMovedJune McEnroe 2021-01-10Set less search case-insensitiveJune McEnroe 2021-01-10Set EXINITJune McEnroe neovim is laggy as hell in my OpenBSD VM, so I switched to vi so I could type without getting frustrated. 2021-01-09Add c -t flag to print expression typeJune McEnroe Also add missing float case. 2021-01-05Update taglineJune McEnroe