Fix deadlock in native git protocol client for upload-pack
commit3eaf3931863707bf36efe932ecfbb39fe0e48b06
authorShawn O. Pearce <spearce@spearce.org>
Sun, 10 May 2009 22:48:04 +0000 (10 15:48 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Mon, 11 May 2009 19:55:09 +0000 (11 21:55 +0200)
treed5d97f2182d691494a1f921eaf9fd28ef24668fa
parent9dc39aa6f79f8505fd7cb3b7e5b8d0168c53c223
Fix deadlock in native git protocol client for upload-pack

The upload-pack protocol states that for every flush packet
(aka "0000") sent by the client, we get exactly one NAK or
ACK line back.  However, if multi_ack is enabled, we may
get multiple "ACK %s continue" lines before the ACK/NAK is
sent by the upload-pack server.

Unfortunately, JGit was counting an "ACK %s continue" as a response
to a flush packet, causing the client side to stop reading from
the server too early.  This left a lot of "ACK %s continue" lines
in the server output buffer, eventually causing the server to stop
and wait for the output buffer to drain.  However, the client would
also get stuck after sending too many "have %s" lines, eventually
deadlocking the entire client-server pair.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit/src/org/spearce/jgit/transport/BasePackFetchConnection.java