From 5707b15920a1ce57f01db0d592487d833218be9d Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 20 Dec 2019 16:26:01 -0500 Subject: Exit when server gets POLLHUP This should maybe gracefully inform clients of what happened, but for now this is much better than the infinite poll loop that happened previously. --- bounce.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bounce.c b/bounce.c index 2b1413d..8dc2850 100644 --- a/bounce.c +++ b/bounce.c @@ -413,7 +413,10 @@ int main(int argc, char *argv[]) { if (!revents) continue; if (event.fds[i].fd == server) { - serverRecv(); + if (revents & POLLIN) serverRecv(); + if (revents & (POLLHUP | POLLERR)) { + errx(EX_UNAVAILABLE, "server closed connection"); + } continue; } -- cgit 1.4.1