Download raw body.
fix gotd_imsg_flush()
On a repository with more about 450 references, gotd fails to send
the initial reference announcement to clients because it runs into
an EAGAIN error from imsg_flush() during communication between
repo_read and the parent process.
This patch makes it work reliably by retrying queued messages when
imsg_flush() fails with EAGAIN.
ok?
diff /home/stsp/src/got
commit - 35bbeac873a7d5494c91b3bf2cc0b6c7f89ab569
path + /home/stsp/src/got
blob - 3c1a799bc318b9a6294c4a902145a0983b95815b
file + gotd/imsg.c
--- gotd/imsg.c
+++ gotd/imsg.c
@@ -57,18 +57,23 @@ gotd_imsg_flush(struct imsgbuf *ibuf)
const struct got_error *
gotd_imsg_flush(struct imsgbuf *ibuf)
{
- const struct got_error *err;
+ const struct got_error *err = NULL;
- err = got_poll_fd(ibuf->fd, POLLOUT, INFTIM);
- if (err)
- return err;
+ while (ibuf->w.queued > 0) {
+ err = got_poll_fd(ibuf->fd, POLLOUT, INFTIM);
+ if (err)
+ break;
- if (imsg_flush(ibuf) == -1) {
- imsg_clear(ibuf);
- return got_error_from_errno("imsg_flush");
- }
+ if (imsg_flush(ibuf) == -1) {
+ if (errno != EAGAIN) {
+ imsg_clear(ibuf);
+ err = got_error_from_errno("imsg_flush");
+ break;
+ }
+ }
+ }
- return NULL;
+ return err;
}
const struct got_error *
fix gotd_imsg_flush()