summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-12-20 16:26:01 -0500
committerJune McEnroe <june@causal.agency>2019-12-20 16:26:01 -0500
commit5707b15920a1ce57f01db0d592487d833218be9d (patch)
treef289c76d87d90dfc00f11d35b05cbeab4c8ed48a
parentAdd CONTRIBUTING section to README (diff)
downloadpounce-5707b15920a1ce57f01db0d592487d833218be9d.tar.gz
pounce-5707b15920a1ce57f01db0d592487d833218be9d.zip
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.
-rw-r--r--bounce.c5
1 files changed, 4 insertions, 1 deletions
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;
 			}
 
o window.cJune McEnroe 2022-02-19Enable -Wmissing-prototypesJune McEnroe 2022-02-19Fix edit.[ch] license notice additional permissionsJune McEnroe 2022-02-19Run line editing testsJune McEnroe 2022-02-18Implement new line editing "library"June McEnroe 2022-02-18Simplify cursor positioning in inputJune McEnroe 2022-02-18Fix M-f orderingJune McEnroe 2022-02-12Move sandman build to scripts/MakefileJune McEnroe 2022-02-12Use compat_readpassphrase.c on LinuxJune McEnroe 2022-02-12Copy RPP defines from oconfigureJune McEnroe