aboutsummaryrefslogtreecommitdiff
path: root/builtin-upload-archive.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 /builtin-upload-archive.c
parent1b19fa46344f512949270dc88089574950519ea3 (diff)
downloadgit-6b59f51b312f06d9420d34c09fa408c658aac6d2.tar.gz
git-6b59f51b312f06d9420d34c09fa408c658aac6d2.tar.xz
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 'builtin-upload-archive.c')
-rw-r--r--builtin-upload-archive.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/builtin-upload-archive.c b/builtin-upload-archive.c
index f6c4c0f14..58f6b8f37 100644
--- a/builtin-upload-archive.c
+++ b/builtin-upload-archive.c
@@ -132,7 +132,6 @@ int cmd_upload_archive(int argc, const char **argv, const char *prefix)
while (1) {
struct pollfd pfd[2];
- ssize_t processed[2] = { 0, 0 };
int status;
pfd[0].fd = fd1[0];
@@ -147,15 +146,14 @@ int cmd_upload_archive(int argc, const char **argv, const char *prefix)
}
continue;
}
- if (pfd[0].revents & POLLIN)
- /* Data stream ready */
- processed[0] = process_input(pfd[0].fd, 1);
if (pfd[1].revents & POLLIN)
/* Status stream ready */
- processed[1] = process_input(pfd[1].fd, 2);
- /* Always finish to read data when available */
- if (processed[0] || processed[1])
- continue;
+ if (process_input(pfd[1].fd, 2))
+ continue;
+ if (pfd[0].revents & POLLIN)
+ /* Data stream ready */
+ if (process_input(pfd[0].fd, 1))
+ continue;
if (waitpid(writer, &status, 0) < 0)
error_clnt("%s", lostchild);