Git development
 help / color / mirror / Atom feed
From: Daniel Barkalow <barkalow@iabervon.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH 2/2] Clean up connection correctly if object fetch wasn't done
Date: Mon, 4 Feb 2008 13:26:29 -0500 (EST)	[thread overview]
Message-ID: <alpine.LNX.1.00.0802041326260.13593@iabervon.org> (raw)

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>
---
 builtin-fetch.c |    2 ++
 transport.c     |   10 +++++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/builtin-fetch.c b/builtin-fetch.c
index 320e235..ac335f2 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -557,6 +557,8 @@ static int do_fetch(struct transport *transport,
 
 	free_refs(fetch_map);
 
+	transport_disconnect(transport);
+
 	return 0;
 }
 
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;
 }
 
-- 
1.5.4

             reply	other threads:[~2008-02-04 18:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-04 18:26 Daniel Barkalow [this message]
2008-02-04 20:23 ` [PATCH 2/2] Clean up connection correctly if object fetch wasn't done Johannes Schindelin
2008-02-04 21:06   ` Daniel Barkalow
2008-02-04 21:21     ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.1.00.0802041326260.13593@iabervon.org \
    --to=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox