diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-08-02 10:17:21 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-08-20 17:41:27 -0700 |
commit | cc6210619b82dc0c7bdb014b5ccf29d6f93e5ef3 (patch) | |
tree | d618c9ee5f8ddc8d16b0c5a1c4827c4de69b7c3e | |
parent | de78cf33672813feecce36637694b189f1c10082 (diff) | |
download | jgit-cc6210619b82dc0c7bdb014b5ccf29d6f93e5ef3.tar.gz jgit-cc6210619b82dc0c7bdb014b5ccf29d6f93e5ef3.zip |
Flush the pack header as soon as its ready
When the output stream is deeply buffered (e.g. 1 MiB or more in
an HTTP servlet on some containers) trying to kick out the header
earlier will prevent the client from stalling hard while the first
1 MiB is received and it can process the pack header. Forcing a
flush here lets the client see the header and start its progress
monitor for "Receiving objects: (1/N)" so the user knows there
is still activity occurring, even though the buffering may cause
there to be some lag as the buffer fills up on the sending side.
Change-Id: I3edf39e8f703fe87a738dc236d426b194db85e3a
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java index df5594cf44..1bb11c3a0d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java @@ -487,6 +487,7 @@ public class PackWriter { int objCnt = getObjectsNumber(); writeMonitor.beginTask(JGitText.get().writingObjects, objCnt); out.writeFileHeader(PACK_VERSION_GENERATED, objCnt); + out.flush(); writeObjects(writeMonitor, out); writeChecksum(out); |