Commit 1c72c59a by Edward Thomson

smart: don't assume directionality

A transport may want to validate that it's in a sane state; when
flushing on close, don't assume that we're doing an upload-pack; send
the correct direction.
parent a283c1bd
......@@ -370,17 +370,27 @@ static int git_smart__close(git_transport *transport)
git_vector *common = &t->common;
unsigned int i;
git_pkt *p;
git_smart_service_t service;
int ret;
git_smart_subtransport_stream *stream;
const char flush[] = "0000";
if (t->direction == GIT_DIRECTION_FETCH) {
service = GIT_SERVICE_UPLOADPACK;
} else if (t->direction == GIT_DIRECTION_PUSH) {
service = GIT_SERVICE_RECEIVEPACK;
} else {
git_error_set(GIT_ERROR_NET, "invalid direction");
return -1;
}
/*
* 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->wrapped->action(&stream, t->wrapped, t->url, service)) {
t->current_stream->write(t->current_stream, flush, 4);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment