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;
 			}
 
21:57:20 -0400'>2022-06-10Handle subshells (and functions) inside substitutionsJune McEnroe 2022-06-10Switch to jorts Install scriptJune McEnroe 2022-06-08Indicate if still reading or no resultsJune McEnroe 2022-06-08Add Maiden, Mother, CroneJune McEnroe Mixed bag like most collections of short stories. Some of them are pretty good. The author of the worst written story also has the worst written bio. 2022-06-05FIRST SHOW IN 2.5 YEARS BABEY!!!June McEnroe 2022-06-03Set line number on File linesJune McEnroe 2022-06-03Stop polling stdin after EOFJune McEnroe 2022-06-02Set TABSIZE=4June McEnroe Absolutely indiscriminately. 2022-06-02Do basic match highlightingJune McEnroe 2022-06-02Clean up parsing a littleJune McEnroe 2022-06-02Don't duplicate path stringJune McEnroe 2022-06-02Use stderr instead of /dev/tty, realloc buffer if lines too longJune McEnroe For some reason I haven't been able to figure out, trying to poll /dev/tty returns POLLNVAL (and this was using 100% CPU looping), but using stderr instead works fine. 2022-06-02Add initial working version of qfJune McEnroe 2022-05-29Set prompt for okshJune McEnroe