TerraSync: tweak warnings around checksum failures
Trying to reduce log spam when there is a server-side failure.
This commit is contained in:
parent
4d905135e8
commit
0ab81d36b9
@ -417,7 +417,7 @@ public:
|
|||||||
SG_LOG(SG_TERRASYNC, SG_WARN, "updated file but not found in dir:" << _relativePath << " " << file);
|
SG_LOG(SG_TERRASYNC, SG_WARN, "updated file but not found in dir:" << _relativePath << " " << file);
|
||||||
} else {
|
} else {
|
||||||
if (it->hash != hash) {
|
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
|
// 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.
|
// middle of a server-side update, the downloaded file may actually become valid.
|
||||||
_repository->failedToUpdateChild(_relativePath, HTTPRepository::REPO_ERROR_CHECKSUM);
|
_repository->failedToUpdateChild(_relativePath, HTTPRepository::REPO_ERROR_CHECKSUM);
|
||||||
@ -1209,15 +1209,15 @@ HTTPRepository::failure() const
|
|||||||
} else if (fileStatus == HTTPRepository::REPO_ERROR_CANCELLED) {
|
} else if (fileStatus == HTTPRepository::REPO_ERROR_CANCELLED) {
|
||||||
// if we were cancelled, don't report or log
|
// if we were cancelled, don't report or log
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
SG_LOG(SG_TERRASYNC, SG_WARN, "failed to update entry:" << relativePath << " status/code: "
|
||||||
|
<< innerResultCodeAsString(fileStatus) << "/" << fileStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
Failure f;
|
Failure f;
|
||||||
f.path = relativePath;
|
f.path = relativePath;
|
||||||
f.error = fileStatus;
|
f.error = fileStatus;
|
||||||
failures.push_back(f);
|
failures.push_back(f);
|
||||||
|
|
||||||
SG_LOG(SG_TERRASYNC, SG_WARN, "failed to update entry:" << relativePath << " status/code: "
|
|
||||||
<< innerResultCodeAsString(fileStatus) << "/" << fileStatus);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // of namespace simgear
|
} // of namespace simgear
|
||||||
|
@ -193,6 +193,8 @@ void Request::onDone()
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void Request::onFail()
|
void Request::onFail()
|
||||||
{
|
{
|
||||||
|
// log if we FAIELD< but not if we CANCELLED
|
||||||
|
if (_ready_state == FAILED) {
|
||||||
SG_LOG
|
SG_LOG
|
||||||
(
|
(
|
||||||
SG_IO,
|
SG_IO,
|
||||||
@ -201,6 +203,7 @@ void Request::onFail()
|
|||||||
<< responseCode() << "/" << responseReason()
|
<< responseCode() << "/" << responseReason()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void Request::onAlways()
|
void Request::onAlways()
|
||||||
@ -344,12 +347,17 @@ void Request::setSuccess(int code)
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void Request::setFailure(int code, const std::string& reason)
|
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);
|
SG_LOG(SG_IO, SG_WARN, "HTTP request: set failure:" << code << " reason " << reason);
|
||||||
|
}
|
||||||
|
|
||||||
_responseStatus = code;
|
_responseStatus = code;
|
||||||
_responseReason = reason;
|
_responseReason = reason;
|
||||||
|
|
||||||
if( !isComplete() )
|
if( !isComplete() ) {
|
||||||
setReadyState(FAILED);
|
setReadyState(code < 0 ? CANCELLED : FAILED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -373,6 +381,12 @@ void Request::setReadyState(ReadyState state)
|
|||||||
|
|
||||||
_cb_fail(this);
|
_cb_fail(this);
|
||||||
}
|
}
|
||||||
|
else if (state == CANCELLED )
|
||||||
|
{
|
||||||
|
onFail(); // do this for compatability
|
||||||
|
onAlways();
|
||||||
|
_cb_fail(this);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -402,7 +416,7 @@ bool Request::serverSupportsPipelining() const
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool Request::isComplete() const
|
bool Request::isComplete() const
|
||||||
{
|
{
|
||||||
return _ready_state == DONE || _ready_state == FAILED;
|
return _ready_state == DONE || _ready_state == FAILED || _ready_state == CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -54,7 +54,8 @@ public:
|
|||||||
HEADERS_RECEIVED,
|
HEADERS_RECEIVED,
|
||||||
LOADING,
|
LOADING,
|
||||||
DONE,
|
DONE,
|
||||||
FAILED
|
FAILED,
|
||||||
|
CANCELLED
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~Request();
|
virtual ~Request();
|
||||||
|
Loading…
Reference in New Issue
Block a user