commit bcb309261e439efc6ff6b567d9df9f6b837364bf
from: Stefan Sperling <stsp@stsp.name>
date: Tue Apr 30 17:34:27 2024 UTC

attempt to fix lingering gotd processes from reading clients 

When reading clients close the connection early do not ignore
this condition in session_read. The code removed here intended
to handle the case of a writing client uploading a pack file,
and thus does not belong into session_read.c.
I overlooked this when splitting session.c into two files.

This might fix an issue observed on got.g.o where the anonymous
user was no longer connected and left lingering session_read and
repo_read processes hanging around until the request timeout was
reached.

commit - caa6cf11e1afc94b38d5250e9b6fe574a6e5ca80
commit + bcb309261e439efc6ff6b567d9df9f6b837364bf
blob - d071fb994783827aad7f9d55c28f54ecdbbf0f0d
blob + b1447765c6f0352994c8d4911d6d1fe8a68514f5
--- gotd/session_read.c
+++ gotd/session_read.c
@@ -462,15 +462,7 @@ session_dispatch_client(int fd, short events, void *ar
 	if (events & EV_WRITE) {
 		while (ibuf->w.queued) {
 			n = msgbuf_write(&ibuf->w);
-			if (n == -1 && errno == EPIPE) {
-				/*
-				 * The client has closed its socket.
-				 * This can happen when Git clients are
-				 * done sending pack file data.
-				 */
-				msgbuf_clear(&ibuf->w);
-				continue;
-			} else if (n == -1 && errno != EAGAIN) {
+			if (n == -1 && errno != EAGAIN) {
 				err = got_error_from_errno("imsg_flush");
 				disconnect_on_error(client, err);
 				return;