summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Marti <vicent@github.com>2014-05-21 13:07:45 +0200
committerVicent Marti <vicent@github.com>2014-05-21 13:07:45 +0200
commit2bc36faccea049d7e8e87de1c27adfbbdd77e1be (patch)
tree1cfdf202187a1ea9048241a68f0b8c851a5c4454
parent58532ed07619e3576f4e7982ffc28cead44cb661 (diff)
parentac11219b8014fec1c5a83f1b19cf78015adc856c (diff)
downloadlibgit2-2bc36faccea049d7e8e87de1c27adfbbdd77e1be.tar.gz
Merge pull request #2372 from libgit2/cmn/fetch-terminate
smart: send a flush when we disconnect
-rw-r--r--src/transports/smart.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/transports/smart.c b/src/transports/smart.c
index 69eaf9b78..7fb41f788 100644
--- a/src/transports/smart.c
+++ b/src/transports/smart.c
@@ -272,6 +272,18 @@ static int git_smart__close(git_transport *transport)
unsigned int i;
git_pkt *p;
int ret;
+ git_smart_subtransport_stream *stream;
+ const char flush[] = "0000";
+
+ /*
+ * If we're still connected at this point and not using RPC,
+ * we should say goodbye by sending a flush, or git-daemon
+ * will complain that we disconnected unexpectedly.
+ */
+ if (t->connected && !t->rpc &&
+ !t->wrapped->action(&stream, t->wrapped, t->url, GIT_SERVICE_UPLOADPACK)) {
+ t->current_stream->write(t->current_stream, flush, 4);
+ }
ret = git_smart__reset_stream(t, true);