diff --git a/simgear/io/HTTPRepository.cxx b/simgear/io/HTTPRepository.cxx index 1523f59c..ae0ad127 100644 --- a/simgear/io/HTTPRepository.cxx +++ b/simgear/io/HTTPRepository.cxx @@ -417,7 +417,7 @@ public: SG_LOG(SG_TERRASYNC, SG_WARN, "updated file but not found in dir:" << _relativePath << " " << file); } else { if (it->hash != hash) { - SG_LOG(SG_TERRASYNC, SG_INFO, "Checksum error for " << absolutePath() << "/" << file << " " << it->hash << " " << hash); + SG_LOG(SG_TERRASYNC, SG_WARN, "Checksum error for " << absolutePath() << "/" << file << " " << it->hash << " " << hash); // we don't erase the file on a hash mismatch, because if we're syncing during the // middle of a server-side update, the downloaded file may actually become valid. _repository->failedToUpdateChild(_relativePath, HTTPRepository::REPO_ERROR_CHECKSUM); @@ -1209,15 +1209,15 @@ HTTPRepository::failure() const } else if (fileStatus == HTTPRepository::REPO_ERROR_CANCELLED) { // if we were cancelled, don't report or log return; + } else { + SG_LOG(SG_TERRASYNC, SG_WARN, "failed to update entry:" << relativePath << " status/code: " + << innerResultCodeAsString(fileStatus) << "/" << fileStatus); } Failure f; f.path = relativePath; f.error = fileStatus; failures.push_back(f); - - SG_LOG(SG_TERRASYNC, SG_WARN, "failed to update entry:" << relativePath << " status/code: " - << innerResultCodeAsString(fileStatus) << "/" << fileStatus); } } // of namespace simgear diff --git a/simgear/io/HTTPRequest.cxx b/simgear/io/HTTPRequest.cxx index c9a25a47..d96caf9d 100644 --- a/simgear/io/HTTPRequest.cxx +++ b/simgear/io/HTTPRequest.cxx @@ -193,13 +193,16 @@ void Request::onDone() //------------------------------------------------------------------------------ void Request::onFail() { - SG_LOG - ( - SG_IO, - SG_INFO, - "request failed:" << url() << " : " - << responseCode() << "/" << responseReason() - ); + // log if we FAIELD< but not if we CANCELLED + if (_ready_state == FAILED) { + SG_LOG + ( + SG_IO, + SG_INFO, + "request failed:" << url() << " : " + << responseCode() << "/" << responseReason() + ); + } } //------------------------------------------------------------------------------ @@ -344,12 +347,17 @@ void Request::setSuccess(int code) //------------------------------------------------------------------------------ void Request::setFailure(int code, const std::string& reason) { + // we use -1 for cancellation, don't be noisy in that case + if (code >= 0) { SG_LOG(SG_IO, SG_WARN, "HTTP request: set failure:" << code << " reason " << reason); + } + _responseStatus = code; _responseReason = reason; - if( !isComplete() ) - setReadyState(FAILED); + if( !isComplete() ) { + setReadyState(code < 0 ? CANCELLED : FAILED); + } } //------------------------------------------------------------------------------ @@ -373,6 +381,12 @@ void Request::setReadyState(ReadyState state) _cb_fail(this); } + else if (state == CANCELLED ) + { + onFail(); // do this for compatability + onAlways(); + _cb_fail(this); + } else return; @@ -402,7 +416,7 @@ bool Request::serverSupportsPipelining() const //------------------------------------------------------------------------------ bool Request::isComplete() const { - return _ready_state == DONE || _ready_state == FAILED; + return _ready_state == DONE || _ready_state == FAILED || _ready_state == CANCELLED; } //------------------------------------------------------------------------------ diff --git a/simgear/io/HTTPRequest.hxx b/simgear/io/HTTPRequest.hxx index a8f17341..716fe668 100644 --- a/simgear/io/HTTPRequest.hxx +++ b/simgear/io/HTTPRequest.hxx @@ -54,7 +54,8 @@ public: HEADERS_RECEIVED, LOADING, DONE, - FAILED + FAILED, + CANCELLED }; virtual ~Request();