commit 30f4f45ab170674753968ff93bec290413aa0b04 from: Stefan Sperling date: Wed Mar 19 14:10:01 2025 UTC send request timeout to session_read so it no longer needs to read gotd.conf Also stop reading gotd.conf in repo_read, which is a trivial no-op. commit - c053f075633c96e223da5a7f351ae2ecbe75cce7 commit + 30f4f45ab170674753968ff93bec290413aa0b04 blob - d6ffdd3c73f0af83f885ee93565f6fedcfd8501a blob + 86f406ddbb1a75923554e0c2a2f17011efc328e1 --- gotd/gotd.c +++ gotd/gotd.c @@ -2151,11 +2151,10 @@ gotd_dispatch_client_session(int fd, short event, void err = got_error(GOT_ERR_PRIVSEP_MSG); break; } + err = send_request_timeout(iev, &gotd.request_timeout); + if (err) + break; if (client_is_writing(client)) { - err = send_request_timeout(iev, - &gotd.request_timeout); - if (err) - break; err = send_notification_config(iev, proc->repo_name); if (err) @@ -2987,7 +2986,9 @@ main(int argc, char **argv) if (proc_id != GOTD_PROC_LISTEN && proc_id != GOTD_PROC_AUTH && proc_id != GOTD_PROC_REPO_WRITE && - proc_id != GOTD_PROC_SESSION_WRITE && proc_id != GOTD_PROC_NOTIFY) { + proc_id != GOTD_PROC_REPO_READ && + proc_id != GOTD_PROC_SESSION_WRITE && proc_id != GOTD_PROC_NOTIFY && + proc_id != GOTD_PROC_SESSION_READ) { if (gotd_parse_config(confpath, proc_id, secrets, &gotd) != 0) return 1; @@ -3163,8 +3164,7 @@ main(int argc, char **argv) err(1, "pledge"); #endif apply_unveil_repo_readonly(repo_path, 1); - session_read_main(title, repo_path, pack_fds, temp_fds, - &gotd.request_timeout); + session_read_main(title, repo_path, pack_fds, temp_fds); /* NOTREACHED */ break; case GOTD_PROC_SESSION_WRITE: blob - 07833deb5463d651b8b0bd06cf6edd39acf37365 blob + e3ed47916c3eb8fe92a48e667a22443927f8d805 --- gotd/session_read.c +++ gotd/session_read.c @@ -810,6 +810,11 @@ session_dispatch(int fd, short event, void *arg) case GOTD_IMSG_DISCONNECT: do_disconnect = 1; break; + case GOTD_IMSG_REQUEST_TIMEOUT: + if (imsg_get_data(&imsg, &gotd_session.request_timeout, + sizeof(gotd_session.request_timeout)) == -1) + err = got_error_from_errno("imsg_get_data"); + break; case GOTD_IMSG_CONNECT_REPO_CHILD: err = recv_repo_child(&imsg); if (err) @@ -845,7 +850,7 @@ done: void session_read_main(const char *title, const char *repo_path, - int *pack_fds, int *temp_fds, struct timeval *request_timeout) + int *pack_fds, int *temp_fds) { const struct got_error *err = NULL; struct event evsigint, evsigterm, evsighup, evsigusr1; @@ -854,8 +859,8 @@ session_read_main(const char *title, const char *repo_ gotd_session.pid = getpid(); gotd_session.pack_fds = pack_fds; gotd_session.temp_fds = temp_fds; - memcpy(&gotd_session.request_timeout, request_timeout, - sizeof(gotd_session.request_timeout)); + gotd_session.request_timeout.tv_sec = GOTD_DEFAULT_REQUEST_TIMEOUT; + gotd_session.request_timeout.tv_usec = 0; gotd_session.repo_child_packfd = -1; if (imsgbuf_init(&gotd_session.notifier_iev.ibuf, -1) == -1) { blob - 5505ce95744a9ce3f739e8747e99604e4e7380f1 blob + fd0ac0b6caadc07f22574d9c51eb8cc9d76176ea --- gotd/session_read.h +++ gotd/session_read.h @@ -14,5 +14,4 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -void session_read_main(const char *, const char *, int *, int *, - struct timeval *); +void session_read_main(const char *, const char *, int *, int *);