Skip to content

Commit 066bf4c

Browse files
committed
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 <[email protected]> Acked-by: Shawn Pearce <[email protected]>
1 parent 6afca45 commit 066bf4c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

builtin/fetch-pack.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,14 @@ static void send_request(int fd, struct strbuf *buf)
218218
safe_write(fd, buf->buf, buf->len);
219219
}
220220

221-
#define INITIAL_FLUSH 32
221+
#define INITIAL_FLUSH 16
222222
#define LARGE_FLUSH 1024
223223

224224
static int next_flush(int count)
225225
{
226-
if (count < LARGE_FLUSH)
226+
if (count < INITIAL_FLUSH * 2)
227+
count += INITIAL_FLUSH;
228+
else if (count < LARGE_FLUSH)
227229
count <<= 1;
228230
else
229231
count += LARGE_FLUSH;

0 commit comments

Comments
 (0)