Commit Diff


commit - c15576d6457ced2ac30752e2823f0ec6d744a696
commit + 808264b2482b61d7bab9f3d7b0b4a9703a3942cd
blob - b3d7c90be3c833b735c00213a56ae5b0cef546d9
blob + a7909cda7bea938e35a6993ddcec3881ec5c7df1
--- gotd/session.c
+++ gotd/session.c
@@ -83,6 +83,7 @@ static struct gotd_session_client {
 	char				*packidx_path;
 	int				 nref_updates;
 	int				 accept_flush_pkt;
+	int				 flush_disconnect;
 } gotd_session_client;
 
 void gotd_session_sighdlr(int sig, short event, void *arg);
@@ -545,7 +546,7 @@ done:
 		client->nref_updates--;
 		if (client->nref_updates == 0) {
 			send_refs_updated(client);
-			*shut = 1;
+			client->flush_disconnect = 1;
 		}
 
 	}
@@ -1055,6 +1056,11 @@ session_dispatch_client(int fd, short events, void *ar
 				disconnect_on_error(client, err);
 				return;
 			}
+		}
+
+		if (client->flush_disconnect) {
+			disconnect(client);
+			return;
 		}
 	}