git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 26, 2008, 22:06 UTC
Message-ID
<alpine.LSU.1.00.0801262205130.23907@racer.site>
In-Reply-To
<alpine.LNX.1.00.0801261647310.13593@iabervon.org>
Hi,
On Sat, 26 Jan 2008, Daniel Barkalow wrote:
Show 11 quoted lines
> 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@iabervon.org>
> ---
> 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.
Show 20 quoted lines
> 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

Previous: Daniel Barkalow
Message 2 of 2 in “Clean up connection correctly if object fetch wasn't done”
  1. Clean up connection correctly if object fetch wasn't doneDaniel Barkalow, Jan 26, 2008
  2. Johannes SchindelinJan 26, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.