From f35aa8d952c6d66c81c487a3fd89828e63ccdee5 Mon Sep 17 00:00:00 2001 From: Dima Zavin Date: Mon, 16 Mar 2009 10:34:24 -0700 Subject: [PATCH] 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 Signed-off-by: Shawn O. Pearce --- org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java b/org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java index 71acda19..204859c3 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/UploadPack.java @@ -351,7 +351,7 @@ public class UploadPack { if (line.length() == 0) { if (commonBase.isEmpty() || multiAck) pckOut.writeString("NAK\n"); - + pckOut.flush(); } else if (line.startsWith("have ") && line.length() == 45) { final ObjectId id = ObjectId.fromString(line.substring(5)); if (matchHave(id)) { -- 2.11.4.GIT