Subject: [PATCH v2 2/3] transport-helper: run do_take_over in connect_helper

From: Jiang Xin <[email-masked]>
Date: Sat, 23 Sep 2023 23:22:00 +0800

From: Jiang Xin <[email-masked]>

After successfully connecting to the smart transport by calling
"process_connect_service()" in "connect_helper()", run "do_take_over()"
to replace the old vtable with a new one which has methods ready for
the smart transport connection.

The subsequent commit introduces remote archive for a stateless-rpc
connection. But without running "do_take_over()", it may fail to call
"transport_disconnect()" in "run_remote_archiver()" of
"builtin/archive.c". This is because for a stateless connection or a
service like "git-upload-pack-archive", the remote helper may receive a
SIGPIPE signal and exit early. To have a graceful disconnect method by
calling "do_take_over()" will solve this issue.

Signed-off-by: Jiang Xin <[email-masked]>
---
 transport-helper.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/transport-helper.c b/transport-helper.c
index 2e127d24a5..3c8802b7a3 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -668,6 +668,8 @@ static int connect_helper(struct transport *transport, const char *name,
 
 	fd[0] = data->helper->out;
 	fd[1] = data->helper->in;
+
+	do_take_over(transport);
 	return 0;
 }
 
-- 
2.40.1.50.gf560bcc116.dirty