Re: [RFC PATCH v3 6/8] Support remote helpers implementing smart transports
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Dec 7, 2009, 18:11 UTC
- Message-ID
- <20091207181148.GG17173@spearce.org>
- In-Reply-To
- <1260116931-16549-7-git-send-email-ilari.liusvaara@elisanet.fi>
Ilari Liusvaara <ilari.liusvaara@elisanet.fi> wrote:
Show 14 quoted lines
> diff --git a/transport-helper.c b/transport-helper.c
> index 3d99fe1..e0254bc 100644
> --- a/transport-helper.c
> +++ b/transport-helper.c
> static int fetch(struct transport *transport,
> int nr_heads, struct ref **to_fetch)
> {
> struct helper_data *data = transport->data;
> int i, count;
>
> + if (process_connect(transport, 0)) {
> + transport_take_over(transport);
> + return transport->fetch(transport, nr_heads, to_fetch);
> + }We should already be connected because of the prior call into get_refs_list(). If I read your code correctly we'd try to open a new connection right here, which makes no sense. But its also possible for us to be in a different transport, so we do code with the assumption that we didn't get invoked through get_refs_list() first and therefore need to open the connection ourselves.
Also, given the above invocation pattern, I see no reason why you need the disown virtual function on struct transport*. Just pass the #@!**! struct child* into transport_take_over() from the 3 call sites here and get rid of that unnecessary indirection.
-- Shawn.