"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
don't ignore err in session_dispatch_repo_child()
To:
gameoftrees@openbsd.org
Date:
Tue, 16 Apr 2024 11:26:12 +0200

Download raw body.

Thread
we could fail handilng the imsg and try to keep going on.  spotted by
breaking something else by accident and observing the regress hanging.

ok?

diff -s /home/op/w/got
commit - 53c2bfa8e1d5c3e128dcfcfd90c1a55099168eba
path + /home/op/w/got (staged changes)
blob - a2ef1cc69a5fc843bdf614504cb3e75f03180015
blob + 1d073e97037a9cb64129ca446a58b0f3fe2a2a62
--- gotd/session_write.c
+++ gotd/session_write.c
@@ -889,31 +889,31 @@ session_dispatch_repo_child(int fd, short event, void 
 		case GOTD_IMSG_REF_UPDATE:
 			err = recv_ref_update(&imsg);
 			if (err == NULL)
 				do_ref_update = 1;
 			break;
 		case GOTD_IMSG_NOTIFY:
 			err = recv_notification_content(&imsg);
 			if (err == NULL)
 				do_notify = 1;
 			break;
 		default:
 			log_debug("unexpected imsg %d", imsg.hdr.type);
 			break;
 		}
 
-		if (do_disconnect) {
+		if (do_disconnect || err) {
 			if (err)
 				disconnect_on_error(client, err);
 			else
 				disconnect(client);
 		} else {
 			struct gotd_session_notif *notif;
 
 			if (do_packfile_install)
 				err = install_pack(client,
 				    gotd_session.repo->path, &imsg);
 			else if (do_ref_updates)
 				err = begin_ref_updates(client, &imsg);
 			else if (do_ref_update)
 				err = update_ref(&shut, client,
 				    gotd_session.repo->path, &imsg);