{"thread":{"id":"26781","subject":"[PATCH 2/3] fetch-pack: progressively use larger handshake windows","startedAt":"2011-03-18T22:27:39Z","lastAt":"2011-03-18T22:27:39Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"163686","messageId":"7vzkosrrms.fsf@alter.siamese.dyndns.org","threadId":"26781","inReplyTo":null,"subject":"[PATCH 2/3] fetch-pack: progressively use larger handshake windows","fromName":"Junio C Hamano","fromEmail":"junio@pobox.com","sentAt":"2011-03-18T22:27:39Z","receivedAt":"2011-03-18T22:27:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The client has to dig the history deeper when more recent parts of its\nhistory do not have any overlap with the server it is fetching from. Make\nthe handshake window exponentially larger as we dig deeper, with a\nreasonable upper cap.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n * This uses rather simpleminded \"double up to the limit\".\n\n builtin/fetch-pack.c |    7 ++++++-\n 1 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c\nindex 20e30f5..b4f34a2 100644\n--- a/builtin/fetch-pack.c\n+++ b/builtin/fetch-pack.c\n@@ -219,10 +219,15 @@ static void send_request(int fd, struct strbuf *buf)\n }\n \n #define INITIAL_FLUSH 32\n+#define LARGE_FLUSH 1024\n \n static int next_flush(int count)\n {\n-\treturn INITIAL_FLUSH + count;\n+\tif (count < LARGE_FLUSH)\n+\t\tcount <<= 1;\n+\telse\n+\t\tcount += LARGE_FLUSH;\n+\treturn count;\n }\n \n static int find_common(int fd[2], unsigned char *result_sha1,\n"}]}