From 1cedc9bdaab50b09706d59324b40a91686f86f7e Mon Sep 17 00:00:00 2001 From: claudio Date: Tue, 6 Apr 2021 12:28:56 +0000 Subject: [PATCH] Kill unused globals and swap the POLLIN and POLLOUT handler for the pipe to the main process. OK job@ --- usr.sbin/rpki-client/http.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/usr.sbin/rpki-client/http.c b/usr.sbin/rpki-client/http.c index 137f05f021e..bf86d8a6114 100644 --- a/usr.sbin/rpki-client/http.c +++ b/usr.sbin/rpki-client/http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http.c,v 1.15 2021/04/02 17:10:12 claudio Exp $ */ +/* $OpenBSD: http.c,v 1.16 2021/04/06 12:28:56 claudio Exp $ */ /* * Copyright (c) 2020 Nils Fisher * Copyright (c) 2020 Claudio Jeker @@ -124,10 +124,6 @@ struct tls_config *tls_config; uint8_t *tls_ca_mem; size_t tls_ca_size; -char *resp_buf[MAX_CONNECTIONS]; -size_t resp_bsz[MAX_CONNECTIONS]; -size_t resp_idx; - /* * Return a string that can be used in error message to identify the * connection. @@ -1191,7 +1187,14 @@ proc_http(char *bind_addr, int fd) if (pfds[MAX_CONNECTIONS].revents & POLLHUP) break; - + if (pfds[MAX_CONNECTIONS].revents & POLLOUT) { + switch (msgbuf_write(&msgq)) { + case 0: + errx(1, "write: connection closed"); + case -1: + err(1, "write"); + } + } if (pfds[MAX_CONNECTIONS].revents & POLLIN) { struct http_connection *h; size_t id; @@ -1215,14 +1218,6 @@ proc_http(char *bind_addr, int fd) } } } - if (pfds[MAX_CONNECTIONS].revents & POLLOUT) { - switch (msgbuf_write(&msgq)) { - case 0: - errx(1, "write: connection closed"); - case -1: - err(1, "write"); - } - } for (i = 0; i < MAX_CONNECTIONS; i++) { struct http_connection *conn = http_conns[i]; -- 2.20.1