Skip to content

Commit 2bc36fa

Browse files
author
Vicent Marti
committed
Merge pull request libgit2#2372 from libgit2/cmn/fetch-terminate
smart: send a flush when we disconnect
2 parents 58532ed + ac11219 commit 2bc36fa

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/transports/smart.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,18 @@ static int git_smart__close(git_transport *transport)
272272
unsigned int i;
273273
git_pkt *p;
274274
int ret;
275+
git_smart_subtransport_stream *stream;
276+
const char flush[] = "0000";
277+
278+
/*
279+
* If we're still connected at this point and not using RPC,
280+
* we should say goodbye by sending a flush, or git-daemon
281+
* will complain that we disconnected unexpectedly.
282+
*/
283+
if (t->connected && !t->rpc &&
284+
!t->wrapped->action(&stream, t->wrapped, t->url, GIT_SERVICE_UPLOADPACK)) {
285+
t->current_stream->write(t->current_stream, flush, 4);
286+
}
275287

276288
ret = git_smart__reset_stream(t, true);
277289

0 commit comments

Comments
 (0)