commit 917841c04564edfc3aa914617f46177362ab90b7 from: Omar Polo date: Sun Apr 14 08:57:15 2024 UTC web: detect EOF after the ev/bufio update amused-web could spin since it didn't detect the EOF. commit - 6be8143330044a05a09e0ea4510d28027f79c13a commit + 917841c04564edfc3aa914617f46177362ab90b7 blob - 16ad7fe7ebf1a6a063c5bd5e0c857c199237825b blob + 2fb57c36fef104a8eb2a871e6d109ad7b43cc6a7 --- web/web.c +++ web/web.c @@ -935,19 +935,24 @@ static void client_ev(int fd, int ev, void *d) { struct client *clt = d; + ssize_t ret; if (ev & EV_READ) { - if (bufio_read(&clt->bio) == -1 && errno != EAGAIN) { + if ((ret = bufio_read(&clt->bio)) == -1 && errno != EAGAIN) { log_warn("bufio_read"); goto err; } + if (ret == 0) + goto err; } if (ev & EV_WRITE) { - if (bufio_write(&clt->bio) == -1 && errno != EAGAIN) { + if ((ret = bufio_write(&clt->bio)) == -1 && errno != EAGAIN) { log_warn("bufio_write"); goto err; } + if (ret == 0) + goto err; } if (clt->route == NULL) {