summary refs log tree commit diff
path: root/bounce.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-10-27 00:44:14 -0400
committerJune McEnroe <june@causal.agency>2019-10-27 00:44:14 -0400
commit755de4c9500fa9fdafc5ac82ee16dd7a19013b9f (patch)
treefc2d702cc44fb4a2d872d0c7990bba7f8a3f1a42 /bounce.c
parentDrop clients on zero-length reads (diff)
downloadpounce-755de4c9500fa9fdafc5ac82ee16dd7a19013b9f.tar.gz
pounce-755de4c9500fa9fdafc5ac82ee16dd7a19013b9f.zip
Reload certificate on SIGUSR1
Diffstat (limited to '')
-rw-r--r--bounce.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/bounce.c b/bounce.c
index b96326b..1015625 100644
--- a/bounce.c
+++ b/bounce.c
@@ -159,14 +159,20 @@ int main(int argc, char *argv[]) {
 
 	signal(SIGINT, signalHandler);
 	signal(SIGTERM, signalHandler);
+	signal(SIGUSR1, signalHandler);
 
 	size_t clients = 0;
 	for (;;) {
 		int nfds = poll(event.fds, event.len, -1);
 		if (nfds < 0 && errno != EINTR) err(EX_IOERR, "poll");
+
 		if (signals[SIGINT] || signals[SIGTERM]) break;
-		if (nfds < 0) continue;
+		if (signals[SIGUSR1]) {
+			listenConfig(certPath, privPath);
+			signals[SIGUSR1] = 0;
+		}
 
+		if (nfds < 0) continue;
 		for (size_t i = 0; i < event.len; ++i) {
 			short revents = event.fds[i].revents;
 			if (!revents) continue;