Commit Diff


commit - 33c550942db6fa1f76a1581d4bc0d0493aad2fff
commit + faf7fad5925f20b61d71682cd984c40b3043484d
blob - 2ac6c8d38c0175476ee810cfc7dd4a08d4eefece
blob + d5a675a1d448373ce99ea836c9148299c88f3d4e
--- gotd/auth.c
+++ gotd/auth.c
@@ -259,8 +259,8 @@ auth_dispatch(int fd, short event, void *arg)
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(ibuf) == -1)
+			fatal("imsgbuf_flush");
 	}
 
 	for (;;) {
blob - 0d701c77551d7e3b172e7c6aef490386f799d5a1
blob + 8b3f29ef924d653a8a2d06521c42f3ce34718ea4
--- gotd/gotd.c
+++ gotd/gotd.c
@@ -581,7 +581,7 @@ gotd_request(int fd, short events, void *arg)
 	ssize_t n;
 
 	if (events & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1) {
+		if (imsgbuf_flush(ibuf) == -1) {
 			/*
 			 * The client has closed its socket.  This can
 			 * happen when Git clients are done sending
@@ -591,7 +591,7 @@ gotd_request(int fd, short events, void *arg)
 				disconnect(client);
 				return;
 			}
-			err = got_error_from_errno("imsgbuf_write");
+			err = got_error_from_errno("imsgbuf_flush");
 			disconnect_on_error(client, err);
 			return;
 		}
@@ -1066,8 +1066,8 @@ gotd_dispatch_listener(int fd, short event, void *arg)
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(ibuf) == -1)
+			fatal("imsgbuf_flush");
 	}
 
 	for (;;) {
@@ -1147,8 +1147,8 @@ gotd_dispatch_notifier(int fd, short event, void *arg)
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(ibuf) == -1)
+			fatal("imsgbuf_flush");
 	}
 
 	for (;;) {
@@ -1220,8 +1220,8 @@ gotd_dispatch_auth_child(int fd, short event, void *ar
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(ibuf) == -1)
+			fatal("imsgbuf_flush");
 		goto done;
 	}
 
@@ -1389,8 +1389,8 @@ gotd_dispatch_client_session(int fd, short event, void
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(ibuf) == -1)
+			fatal("imsgbuf_flush");
 	}
 
 	proc = client->session;
@@ -1544,8 +1544,8 @@ gotd_dispatch_repo_child(int fd, short event, void *ar
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(ibuf) == -1)
+			fatal("imsgbuf_flush");
 	}
 
 	proc = client->repo;
blob - 7a23c27e7e5ef2c9a06d9c08285a201e761e0f14
blob + fa3a34257546e4f94e2a0884df1efca5d638a989
--- gotd/listen.c
+++ gotd/listen.c
@@ -401,8 +401,8 @@ listen_dispatch(int fd, short event, void *arg)
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(ibuf) == -1)
+			fatal("imsgbuf_flush");
 	}
 
 	for (;;) {
blob - ef7e05f8ec82dd6ce60b7a0f2dc52b9341ec2657
blob + fe81597499b4aed3863e9dc2ec128dd6243675bf
--- gotd/notify.c
+++ gotd/notify.c
@@ -391,9 +391,9 @@ notify_dispatch_session(int fd, short event, void *arg
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1) {
+		if (imsgbuf_flush(ibuf) == -1) {
 			if (errno != EPIPE)
-				fatal("imsgbuf_write");
+				fatal("imsgbuf_flush");
 			shut = 1;
 			goto done;
 		}
@@ -523,8 +523,8 @@ notify_dispatch(int fd, short event, void *arg)
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(imsgbuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(imsgbuf) == -1)
+			fatal("imsgbuf_flush");
 	}
 
 	for (;;) {
blob - 76f3da1876604e0cb3f74affa07b5a60239ed6f0
blob + 775032711c4fdef151b37569d36eb4ae6f096289
--- gotd/repo_read.c
+++ gotd/repo_read.c
@@ -694,8 +694,8 @@ repo_read_dispatch_session(int fd, short event, void *
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(ibuf) == -1)
+			fatal("imsgbuf_flush");
 	}
 
 	while (err == NULL && check_cancelled(NULL) == NULL) {
@@ -814,8 +814,8 @@ repo_read_dispatch(int fd, short event, void *arg)
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(ibuf) == -1)
+			fatal("imsgbuf_flush");
 	}
 
 	while (err == NULL && check_cancelled(NULL) == NULL) {
blob - 697e0fffca31dd7a8ab687783615fdb47305f994
blob + e2cb36c1801787fe97ea444ce0cfd506c8756242
--- gotd/repo_write.c
+++ gotd/repo_write.c
@@ -2181,8 +2181,8 @@ repo_write_dispatch_session(int fd, short event, void 
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(ibuf) == -1)
+			fatal("imsgbuf_flush");
 	}
 
 	for (;;) {
@@ -2338,8 +2338,8 @@ repo_write_dispatch(int fd, short event, void *arg)
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(ibuf) == -1)
+			fatal("imsgbuf_flush");
 	}
 
 	while (err == NULL) {
blob - d39251b60acc58450371d8714d902209d7e8d630
blob + 609ad42bb7cd685756ef7ece7671bd972cc5c5fd
--- gotd/session_read.c
+++ gotd/session_read.c
@@ -214,8 +214,8 @@ session_dispatch_repo_child(int fd, short event, void 
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(ibuf) == -1)
+			fatal("imsgbuf_flush");
 	}
 
 	for (;;) {
@@ -456,14 +456,13 @@ session_dispatch_client(int fd, short events, void *ar
 	ssize_t n;
 
 	if (events & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1) {
+		if (imsgbuf_flush(ibuf) == -1) {
 			err = got_error_from_errno("imsg_flush");
 			disconnect_on_error(client, err);
 			return;
 		}
 
-		if (imsgbuf_queuelen(ibuf) == 0 &&
-		    client->flush_disconnect) {
+		if (client->flush_disconnect) {
 			disconnect(client);
 			return;
 		}
@@ -756,14 +755,9 @@ session_dispatch(int fd, short event, void *arg)
 	}
 
 	if (event & EV_WRITE) {
-		n = imsgbuf_write(ibuf);
+		n = imsgbuf_flush(ibuf);
 		if (n == -1)
-			fatal("msgbuf_write");
-		if (n == 0) {
-			/* Connection closed. */
-			shut = 1;
-			goto done;
-		}
+			fatal("imsgbuf_flush");
 	}
 
 	for (;;) {
blob - 7d1bc4205b658904dd18617645e79b0df371cf6f
blob + af976200b8ed574269c7398aa67c4c2024fb6a7b
--- gotd/session_write.c
+++ gotd/session_write.c
@@ -881,8 +881,8 @@ session_dispatch_repo_child(int fd, short event, void 
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(ibuf) == -1)
+			fatal("imsgbuf_flush");
 	}
 
 	for (;;) {
@@ -1207,7 +1207,7 @@ session_dispatch_client(int fd, short events, void *ar
 	ssize_t n;
 
 	if (events & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1) {
+		if (imsgbuf_flush(ibuf) == -1) {
 			/*
 			 * The client has closed its socket.  This can
 			 * happen when Git clients are done sending
@@ -1222,8 +1222,7 @@ session_dispatch_client(int fd, short events, void *ar
 			return;
 		}
 
-		if (imsgbuf_queuelen(ibuf) == 0 &&
-		    client->flush_disconnect) {
+		if (client->flush_disconnect) {
 			disconnect(client);
 			return;
 		}
@@ -1445,8 +1444,8 @@ session_dispatch_notifier(int fd, short event, void *a
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(ibuf) == -1)
+			fatal("imsgbuf_flush");
 	}
 
 	for (;;) {
@@ -1599,8 +1598,8 @@ session_dispatch(int fd, short event, void *arg)
 	}
 
 	if (event & EV_WRITE) {
-		if (imsgbuf_write(ibuf) == -1)
-			fatal("msgbuf_write");
+		if (imsgbuf_flush(ibuf) == -1)
+			fatal("imsgbuf_flush");
 	}
 
 	for (;;) {