commit d1e848871a89381c9d0e349abddd7339eb7e1551 from: Stefan Sperling date: Thu Nov 21 16:57:52 2024 UTC prevent gotd from exiting with pending notifications if client disconnects commit - 37b4ccba4a069ecbe9ee46da8b91850668400ccc commit + d1e848871a89381c9d0e349abddd7339eb7e1551 blob - af976200b8ed574269c7398aa67c4c2024fb6a7b blob + 319e71e7eb3d58e4fa2f98bf5ff1ed64e8b6b52a --- gotd/session_write.c +++ gotd/session_write.c @@ -1212,7 +1212,10 @@ session_dispatch_client(int fd, short events, void *ar * The client has closed its socket. This can * happen when Git clients are done sending * pack file data. + * Pending notifications should still be sent. */ + if (STAILQ_FIRST(¬ifications) != NULL) + return; if (errno == EPIPE) { disconnect(client); return; @@ -1236,6 +1239,14 @@ session_dispatch_client(int fd, short events, void *ar return; } if (n == 0) { + /* + * The client has closed its socket. This can + * happen when Git clients are done sending + * pack file data. + * Pending notifications should still be sent. + */ + if (STAILQ_FIRST(¬ifications) != NULL) + return; err = got_error(GOT_ERR_EOF); disconnect_on_error(client, err); return;