Commit Diff


commit - 7477a2d224dbe68e95d9ad64f112f81bb5a98ab6
commit + c8b73ac1663c35b32c7f8ce4173765461b72f3fa
blob - 389075821465ee8b13c3cc0fb57127feea718885
blob + ae96f8dd8c3df35dfde0827d038a3fec4e55a08a
--- gotd/session.c
+++ gotd/session.c
@@ -80,6 +80,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);
@@ -542,7 +543,7 @@ done:
 		client->nref_updates--;
 		if (client->nref_updates == 0) {
 			send_refs_updated(client);
-			*shut = 1;
+			client->flush_disconnect = 1;
 		}
 
 	}
@@ -1052,6 +1053,11 @@ session_dispatch_client(int fd, short events, void *ar
 				disconnect_on_error(client, err);
 				return;
 			}
+		}
+
+		if (client->flush_disconnect) {
+			disconnect(client);
+			return;
 		}
 	}