summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@fluxnic.net>2009-11-11 17:24:42 -0500
committerJunio C Hamano <gitster@pobox.com>2009-11-13 14:39:25 -0800
commit6b59f51b312f06d9420d34c09fa408c658aac6d2 (patch)
tree3dff3f5acea4ae259283b6fa1c3fda03336f263c /upload-pack.c
parent1b19fa46344f512949270dc88089574950519ea3 (diff)
downloadgit-6b59f51b312f06d9420d34c09fa408c658aac6d2.tar.gz
give priority to progress messages
In theory it is possible for sideband channel #2 to be delayed if pack data is quick to come up for sideband channel #1. And because data for channel #2 is read only 128 bytes at a time while pack data is read 8192 bytes at a time, it is possible for many pack blocks to be sent to the client before the progress message fifo is emptied, making the situation even worse. This would result in totally garbled progress display on the client's console as local progress gets mixed with partial remote progress lines. Let's prevent such situations by giving transmission priority to progress messages over pack data at all times. Signed-off-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/upload-pack.c b/upload-pack.c
index b98b1d61c1..8734f1d1b9 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -218,6 +218,23 @@ static void create_pack_file(void)
}
continue;
}
+ if (0 <= pe && (pfd[pe].revents & (POLLIN|POLLHUP))) {
+ /* Status ready; we ship that in the side-band
+ * or dump to the standard error.
+ */
+ sz = xread(pack_objects.err, progress,
+ sizeof(progress));
+ if (0 < sz)
+ send_client_data(2, progress, sz);
+ else if (sz == 0) {
+ close(pack_objects.err);
+ pack_objects.err = -1;
+ }
+ else
+ goto fail;
+ /* give priority to status messages */
+ continue;
+ }
if (0 <= pu && (pfd[pu].revents & (POLLIN|POLLHUP))) {
/* Data ready; we keep the last byte to ourselves
* in case we detect broken rev-list, so that we
@@ -255,21 +272,6 @@ static void create_pack_file(void)
if (sz < 0)
goto fail;
}
- if (0 <= pe && (pfd[pe].revents & (POLLIN|POLLHUP))) {
- /* Status ready; we ship that in the side-band
- * or dump to the standard error.
- */
- sz = xread(pack_objects.err, progress,
- sizeof(progress));
- if (0 < sz)
- send_client_data(2, progress, sz);
- else if (sz == 0) {
- close(pack_objects.err);
- pack_objects.err = -1;
- }
- else
- goto fail;
- }
}
if (finish_command(&pack_objects)) {