Skip to content

Commit 6afca45

Browse files
committed
fetch-pack: progressively use larger handshake windows
The client has to dig the history deeper when more recent parts of its history do not have any overlap with the server it is fetching from. Make the handshake window exponentially larger as we dig deeper, with a reasonable upper cap. Signed-off-by: Junio C Hamano <[email protected]> Acked-by: Shawn Pearce <[email protected]>
1 parent c12f591 commit 6afca45

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

builtin/fetch-pack.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,15 @@ static void send_request(int fd, struct strbuf *buf)
219219
}
220220

221221
#define INITIAL_FLUSH 32
222+
#define LARGE_FLUSH 1024
222223

223224
static int next_flush(int count)
224225
{
225-
return INITIAL_FLUSH + count;
226+
if (count < LARGE_FLUSH)
227+
count <<= 1;
228+
else
229+
count += LARGE_FLUSH;
230+
return count;
226231
}
227232

228233
static int find_common(int fd[2], unsigned char *result_sha1,

0 commit comments

Comments
 (0)