transport-helper: call do_take_over() in connect_helper
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 connect_helper() function is used as the connect method of the vtable in "transport-helper.c", and it is called by transport_connect() in "transport.c" to setup a connection. The only place that we call transport_connect() so far is in "builtin/archive.c". 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. The subsequent commit will introduce remote archive over a stateless-rpc connection. Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
b57524bc91
commit
7ce60e3b9a
@ -672,6 +672,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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user