fetch-pack: use smaller handshake window for initial request

Start the initial request small by halving the INITIAL_FLUSH (we will try
to stay one window ahead of the server, so we would end up giving twice as
many "have" in flight at the very beginning).  We may want to tweak these
values even more, taking MTU into account.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Shawn Pearce <spearce@spearce.org>
This commit is contained in:
Junio C Hamano 2011-03-20 21:52:45 -07:00
parent 6afca450c3
commit 066bf4c2e4

View File

@ -218,12 +218,14 @@ static void send_request(int fd, struct strbuf *buf)
safe_write(fd, buf->buf, buf->len);
}
#define INITIAL_FLUSH 32
#define INITIAL_FLUSH 16
#define LARGE_FLUSH 1024
static int next_flush(int count)
{
if (count < LARGE_FLUSH)
if (count < INITIAL_FLUSH * 2)
count += INITIAL_FLUSH;
else if (count < LARGE_FLUSH)
count <<= 1;
else
count += LARGE_FLUSH;