Re: [PATCH] Clean up connection correctly if object fetch wasn't done

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Sat, 26 Jan 2008, Daniel Barkalow wrote:

> Further optimization allowed the fetch_objs call to be skipped if it 
> isn't necessary. However, this leaves the connection in need of cleaning 
> up to avoid getting an error message from the remote end when ssh is 
> used. Fix this.
> 
> Signed-off-by: Daniel Barkalow <barkalow@xxxxxxxxxxxx>
> ---
> This fixes the "fatal: The remote end hung up unexpectedly" message in the 
> case I reproduced. It should probably get squashed into the other 
> single-connect commit, but I'm sending it separately for easier testing 
> for now.

Yeah, that fixes it.  Thanks.

> diff --git a/transport.c b/transport.c
> index 53fb2ec..199e9e6 100644
> --- a/transport.c
> +++ b/transport.c
> @@ -677,7 +677,15 @@ static int git_transport_push(struct transport *transport, int refspec_nr, const
>  
>  static int disconnect_git(struct transport *transport)
>  {
> -	free(transport->data);
> +	struct git_transport_data *data = transport->data;
> +	if (data->conn) {
> +		packet_flush(data->fd[1]);
> +		close(data->fd[0]);
> +		close(data->fd[1]);
> +		finish_connect(data->conn);
> +	}
> +
> +	free(data);
>  	return 0;
>  }

Should this not set transport->data = NULL, just to be sure?

Ciao,
Dscho

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux