From ab70090a0a1585b8a32afd05e8bd825cf8bb8493 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 13 Nov 2016 22:18:32 +0100 Subject: [PATCH] Finally fix bogus terrasync download numbers. (Staying a hotel with sufficiently slow wi-fi to debug this!) --- simgear/io/HTTPRepository.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/simgear/io/HTTPRepository.cxx b/simgear/io/HTTPRepository.cxx index af4eecfc..5dff9b50 100644 --- a/simgear/io/HTTPRepository.cxx +++ b/simgear/io/HTTPRepository.cxx @@ -756,7 +756,12 @@ size_t HTTPRepository::bytesToDownload() const } for (r = _d->activeRequests.begin(); r != _d->activeRequests.end(); ++r) { - result += (*r)->contentSize() - (*r)->responseBytesReceived(); + if ((*r)->contentSize() > 0) { + // Content size for root dirindex of a repository is zero, + // and returing a negative value breaks everyting, so just ignore + // it + result += (*r)->contentSize() - (*r)->responseBytesReceived(); + } } return result;