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 <gitster@pobox.com> Acked-by: Shawn Pearce <spearce@spearce.org>
Junio C Hamano committed
Mar 20, 2011 at 21:52 UTC
6afca450c3f2f05385900a7b8d3a0d47286f983f
1 file changed
+6
-1
builtin/fetch-pack.c
+6
-1
@@ -219,10 +219,15 @@ static void send_request(int fd, struct strbuf *buf)
219
}
220
221
#define INITIAL_FLUSH 32
222
+#define LARGE_FLUSH 1024
223
224
static int next_flush(int count)
225
{
225
- return INITIAL_FLUSH + count;
226
+ if (count < LARGE_FLUSH)
227
+ count <<= 1;
228
+ else
229
+ count += LARGE_FLUSH;
230
+ return count;
231
}
232
233
static int find_common(int fd[2], unsigned char *result_sha1,