upload-pack: Force an fd flush after receiving flush pkt from client
commitf35aa8d952c6d66c81c487a3fd89828e63ccdee5
authorDima Zavin <dima@android.com>
Mon, 16 Mar 2009 17:34:24 +0000 (16 10:34 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Mon, 16 Mar 2009 20:01:26 +0000 (16 13:01 -0700)
tree384f5bfe8d94ba126eb3f1673bb581dd898b5f8b
parent00fdad80138d6364b82407c9a6a7438e0b836a71
upload-pack: Force an fd flush after receiving flush pkt from client

The client is blocked waiting for an ACK or NAK line from the server.
If we don't call flush() here there is a very good chance the
ACK/NAK is stuck in our stream buffer within the JRE, and doesn't
make it into the kernel's TCP buffer.  This causes the server to
wait for more have lines, and the client to wait for the ACK/NAK,
and the entire thing just deadlocks.

We flush anytime we see a pkt-line flush command, as there may be
buffered ACK lines from prior evaulations that need to be sent to
the waiting client.

Signed-off-by: Dima Zavin <dima@android.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java