Compare commits

..

22 Commits

Author SHA1 Message Date
James Turner
68fd8e8dba Bump branch patch-level for Package fixes. 2016-05-06 14:26:47 +01:00
James Turner
807330a616 Guard against disabling a not-yet-active catalog. 2016-05-06 14:24:31 +01:00
James Turner
2deb361f0f Packages: handle catalog versions better
When a catalog version is stale, disable it but don’t remove it,
and still try to refresh it. This should give much better behaviour
when the FG version changes, should behave as users expect.
2016-05-06 14:23:54 +01:00
Automatic Release Builder
63e7a1fbb4 new version: 2016.1.1 2016-02-17 21:16:32 +01:00
Torsten Dreyer
951859d8a7 correct user-agent string for terrasync 2016-02-15 16:53:31 +01:00
James Turner
41f40a9a10 Fix misnamed macro.
- should fix TerraSync user-agent.
2016-02-08 09:37:35 +00:00
Rebecca N. Palmer
a6290e367a math: 'void getMaxSubdiv' does not make any sense
Fixes build failure with GCC 6: https://bugs.debian.org/812014
(getMaxSubdiv is currently unused)
2016-02-06 21:16:27 +00:00
James Turner
af0a51930e CMake: don’t export build to build tree
- only export targets to the install tree, since this is
  hopefully compatible with CMake 2.8
2016-02-02 18:33:20 +00:00
James Turner
ccb5d05eb4 Fix headless build for CMake export 2016-01-30 14:29:12 +00:00
James Turner
9d7402242a Work on CMake export of targets. 2016-01-29 23:15:07 +00:00
James Turner
819833a560 VS2013 compile fixes.
- mostly about return type conversions.
2016-01-27 14:02:27 +00:00
Gijs de Rooy
576ff21488 TerraSync log typo 2016-01-20 12:16:14 +01:00
James Turner
b60f8b4989 New log class for terrasync 2016-01-16 15:49:58 -06:00
James Turner
096d625445 Allow use of noreturn attribute with Clang
- other compilers could also be enabled in the future.
2016-01-12 12:48:34 -06:00
James Turner
dad77b3983 Fix a Simgear compile failure. 2016-01-09 09:45:43 -06:00
James Turner
598b64fa95 Linux test_HTTP fixes.
libCurl HTTP unit-test fixes.
2016-01-08 12:17:02 -06:00
James Turner
b5d6aa3fe4 Linux test_HTTP fixes. 2016-01-06 12:57:04 -06:00
James Turner
f32063e6dd Jenkins build fixes. 2016-01-06 00:07:30 -06:00
James Turner
3d9d44cf73 Fix negative loop counts when dt is small. 2016-01-05 23:18:41 -06:00
James Turner
ac84115ac3 Remove obsolete member 2016-01-05 23:17:20 -06:00
James Turner
d58607242e Merge branch 'next' of ssh://git.code.sf.net/p/flightgear/simgear into next 2016-01-05 20:43:25 -06:00
James Turner
f256d45b65 Quiet a debug message. 2016-01-04 13:36:32 -06:00
23 changed files with 264 additions and 119 deletions

View File

@@ -14,6 +14,7 @@ include (CheckIncludeFile)
include (CheckLibraryExists)
include (CheckCXXSourceCompiles)
include (CheckCXXCompilerFlag)
include (GenerateExportHeader)
# using 10.7 because boost requires libc++ and 10.6 doesn't include it
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.7)
@@ -423,6 +424,40 @@ include_directories(3rdparty/utf8/source)
add_subdirectory(3rdparty)
add_subdirectory(simgear)
#-----------------------------------------------------------------------------
### Export stuff, see https://cmake.org/cmake/help/v3.2/manual/cmake-packages.7.html#creating-packages
#-----------------------------------------------------------------------------
generate_export_header(SimGearCore)
if(NOT SIMGEAR_HEADLESS)
generate_export_header(SimGearScene)
endif()
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/SimGear/SimGearConfigVersion.cmake"
VERSION ${SIMGEAR_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_file(SimGearConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/SimGear/SimGearConfig.cmake"
@ONLY
)
set(ConfigPackageLocation lib/cmake/SimGear)
install(EXPORT SimGearTargets
DESTINATION ${ConfigPackageLocation}
)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/SimGear/SimGearConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/SimGear/SimGearConfigVersion.cmake"
DESTINATION ${ConfigPackageLocation}
COMPONENT Devel
)
#-----------------------------------------------------------------------------
### uninstall target
#-----------------------------------------------------------------------------

16
SimGearConfig.cmake.in Normal file
View File

@@ -0,0 +1,16 @@
include(CMakeFindDependencyMacro)
find_dependency(ZLIB)
find_dependency(Threads)
# OSG
set(SIMGEAR_HEADLESS @SIMGEAR_HEADLESS@)
set(SIMGEAR_SOUND @ENABLE_SOUND@)
# OpenAL isn't a public dependency, so maybe not needed
#if (SIMGEAR_SOUND)
# find_dependency(OpenAL)
#endif()
include("${CMAKE_CURRENT_LIST_DIR}/SimGearTargets.cmake")

View File

@@ -54,8 +54,10 @@ if(SIMGEAR_SHARED)
set_property(TARGET SimGearCore PROPERTY LINKER_LANGUAGE CXX)
set_property(TARGET SimGearCore PROPERTY VERSION ${SIMGEAR_VERSION})
set_property(TARGET SimGearCore PROPERTY SOVERSION ${SIMGEAR_SOVERSION})
install(TARGETS SimGearCore EXPORT SimGearCoreConfig LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(EXPORT SimGearCoreConfig DESTINATION share/SimGearCore)
install(TARGETS SimGearCore
EXPORT SimGearTargets
LIBRARY DESTINATION
${CMAKE_INSTALL_LIBDIR})
if(NOT SIMGEAR_HEADLESS)
add_library(SimGearScene SHARED ${sceneSources})
@@ -64,8 +66,10 @@ if(SIMGEAR_SHARED)
set_property(TARGET SimGearScene PROPERTY SOVERSION ${SIMGEAR_SOVERSION})
# EXPORT SimGearSceneConfig
install(TARGETS SimGearScene LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
# install(EXPORT SimGearSceneConfig DESTINATION share/SimGearScene)
install(TARGETS SimGearScene
EXPORT SimGearTargets
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR} )
endif()
else()
@@ -90,7 +94,9 @@ else()
endforeach()
add_library(SimGearCore STATIC ${coreSources} ${localExpatSources})
install(TARGETS SimGearCore ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS SimGearCore
EXPORT SimGearTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(NOT SIMGEAR_HEADLESS)
get_property(FG_GROUPS_SCENE_SOURCES_C GLOBAL PROPERTY FG_GROUPS_SCENE_SOURCES_C)
@@ -112,7 +118,9 @@ else()
endforeach()
add_library(SimGearScene STATIC ${sceneSources})
install(TARGETS SimGearScene ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS SimGearScene
EXPORT SimGearTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(NOT SIMGEAR_HEADLESS)
endif(SIMGEAR_SHARED)

View File

@@ -43,7 +43,7 @@ public:
void removeChild(BVHNode* child);
unsigned getNumChildren() const
{ return _children.size(); }
{ return static_cast<unsigned>(_children.size()); }
const BVHNode* getChild(unsigned i) const
{ if (_children.size() <= i) return 0; return _children[i]; }
BVHNode* getChild(unsigned i)

View File

@@ -31,13 +31,13 @@ public:
virtual ~BVHStaticData() {}
unsigned addVertex(const SGVec3f& vertex)
{ _vertices.push_back(vertex); return _vertices.size() - 1; }
{ _vertices.push_back(vertex); return static_cast<unsigned>(_vertices.size() - 1); }
const SGVec3f& getVertex(unsigned i) const
{ return _vertices[i]; }
unsigned addMaterial(const BVHMaterial* material)
{ _materials.push_back(material); return _materials.size() - 1; }
{ _materials.push_back(material); return static_cast<unsigned>(_materials.size() - 1); }
const BVHMaterial* getMaterial(unsigned i) const
{ if (_materials.size() <= i) return 0; return _materials[i]; }

View File

@@ -190,6 +190,12 @@ inline int (isnan)(double r) { return !(r <= 0 || r >= 0); }
# define DEPRECATED
#endif
#if defined(__clang__)
# define SG_NO_RETURN [[noreturn]]
#else
# define SG_NO_RETURN
#endif
//
// No user modifiable definitions beyond here.
//

View File

@@ -32,7 +32,8 @@ typedef enum {
SG_SOUND = 0x00200000,
SG_NAVAID = 0x00400000,
SG_GUI = 0x00800000,
SG_UNDEFD = 0x01000000, // For range checking
SG_TERRASYNC = 0x01000000,
SG_UNDEFD = 0x02000000, // For range checking
SG_ALL = 0xFFFFFFFF
} sgDebugClass;

View File

@@ -71,6 +71,7 @@ const char* debugClassToString(sgDebugClass c)
case SG_SOUND: return "sound";
case SG_NAVAID: return "navaid";
case SG_GUI: return "gui";
case SG_TERRASYNC: return "terrasync";
default: return "unknown";
}
}

View File

@@ -41,7 +41,7 @@ public:
bool load( const SGPath& path );
// stars
inline int getNumStars() const { return _stars.size(); }
inline int getNumStars() const { return static_cast<int>(_stars.size()); }
inline SGVec3d *getStars() { return &(_stars[0]); }
private:

View File

@@ -193,7 +193,7 @@ public:
{
if (tagStack.empty()) {
if (strcmp(name, DAV_MULTISTATUS_TAG)) {
SG_LOG(SG_IO, SG_WARN, "root element is not " <<
SG_LOG(SG_TERRASYNC, SG_WARN, "root element is not " <<
DAV_MULTISTATUS_TAG << ", got:" << name);
} else {
@@ -202,7 +202,7 @@ public:
// not at the root element
if (tagStack.back() == DAV_MULTISTATUS_TAG) {
if (strcmp(name, DAV_RESPONSE_TAG)) {
SG_LOG(SG_IO, SG_WARN, "multistatus child is not response: saw:"
SG_LOG(SG_TERRASYNC, SG_WARN, "multistatus child is not response: saw:"
<< name);
}
}
@@ -362,7 +362,7 @@ void DAVMultiStatus::parseXML(const char* data, int size)
}
if (!XML_Parse(_d->xmlParser, data, size, false)) {
SG_LOG(SG_IO, SG_WARN, "DAV parse error:" << XML_ErrorString(XML_GetErrorCode(_d->xmlParser))
SG_LOG(SG_TERRASYNC, SG_WARN, "DAV parse error:" << XML_ErrorString(XML_GetErrorCode(_d->xmlParser))
<< " at line:" << XML_GetCurrentLineNumber(_d->xmlParser)
<< " column " << XML_GetCurrentColumnNumber(_d->xmlParser));
@@ -376,7 +376,7 @@ void DAVMultiStatus::finishParse()
{
if (_d->parserInited) {
if (!XML_Parse(_d->xmlParser, NULL, 0, true)) {
SG_LOG(SG_IO, SG_WARN, "DAV parse error:" << XML_ErrorString(XML_GetErrorCode(_d->xmlParser))
SG_LOG(SG_TERRASYNC, SG_WARN, "DAV parse error:" << XML_ErrorString(XML_GetErrorCode(_d->xmlParser))
<< " at line:" << XML_GetCurrentLineNumber(_d->xmlParser)
<< " column " << XML_GetCurrentColumnNumber(_d->xmlParser));
_d->valid = false;

View File

@@ -96,14 +96,14 @@ void SVNDirectory::parseCache()
LineState lineState = LINESTATE_HREF;
std::ifstream file(p.c_str());
if (!file.is_open()) {
SG_LOG(SG_IO, SG_WARN, "unable to open cache file for reading:" << p);
SG_LOG(SG_TERRASYNC, SG_WARN, "unable to open cache file for reading:" << p);
return;
}
bool doneSelf = false;
file.getline(href, 1024);
if (strcmp(CACHE_VERSION_4_TOKEN, href)) {
SG_LOG(SG_IO, SG_WARN, "invalid cache file [missing header token]:" << p << " '" << href << "'");
SG_LOG(SG_TERRASYNC, SG_WARN, "invalid cache file [missing header token]:" << p << " '" << href << "'");
return;
}
@@ -183,7 +183,7 @@ void SVNDirectory::writeCache()
void SVNDirectory::setBaseUrl(const string& url)
{
if (_parent) {
SG_LOG(SG_IO, SG_ALERT, "setting base URL on non-root directory " << url);
SG_LOG(SG_TERRASYNC, SG_ALERT, "setting base URL on non-root directory " << url);
return;
}
@@ -248,7 +248,7 @@ void SVNDirectory::deleteChildByName(const std::string& nm)
Dir d(path);
bool ok = d.remove(true);
if (!ok) {
SG_LOG(SG_NETWORK, SG_ALERT, "SVNDirectory::deleteChildByName: failed to remove dir:"
SG_LOG(SG_TERRASYNC, SG_ALERT, "SVNDirectory::deleteChildByName: failed to remove dir:"
<< nm << " at path:\n\t" << path);
}
@@ -261,7 +261,7 @@ void SVNDirectory::deleteChildByName(const std::string& nm)
} else {
bool ok = path.remove();
if (!ok) {
SG_LOG(SG_NETWORK, SG_ALERT, "SVNDirectory::deleteChildByName: failed to remove path:" << nm
SG_LOG(SG_TERRASYNC, SG_ALERT, "SVNDirectory::deleteChildByName: failed to remove path:" << nm
<< " at path:\n\t" << path);
}
}

View File

@@ -73,7 +73,7 @@ public:
void updateFailed(HTTP::Request* req, SVNRepository::ResultCode err)
{
SG_LOG(SG_IO, SG_WARN, "SVN: failed to update from:" << req->url()
SG_LOG(SG_TERRASYNC, SG_WARN, "SVN: failed to update from:" << req->url()
<< "\n(repository:" << p->baseUrl() << ")");
isUpdating = false;
status = err;
@@ -134,7 +134,7 @@ namespace { // anonmouse
} else if (responseCode() == 404) {
_repo->propFindFailed(this, SVNRepository::SVN_ERROR_NOT_FOUND);
} else {
SG_LOG(SG_IO, SG_WARN, "request for:" << url() <<
SG_LOG(SG_TERRASYNC, SG_WARN, "request for:" << url() <<
" return code " << responseCode());
_repo->propFindFailed(this, SVNRepository::SVN_ERROR_SOCKET);
_repo = NULL;
@@ -231,7 +231,7 @@ protected:
_repo->updateFailed(this, SVNRepository::SVN_ERROR_NOT_FOUND);
_failed = true;
} else {
SG_LOG(SG_IO, SG_WARN, "SVN: request for:" << url() <<
SG_LOG(SG_TERRASYNC, SG_WARN, "SVN: request for:" << url() <<
" got HTTP status " << responseCode());
_repo->updateFailed(this, SVNRepository::SVN_ERROR_HTTP);
_failed = true;
@@ -331,7 +331,7 @@ void SVNRepository::update()
}
if (_d->targetRevision == rootDir()->cachedRevision()) {
SG_LOG(SG_IO, SG_DEBUG, baseUrl() << " in sync at version " << _d->targetRevision);
SG_LOG(SG_TERRASYNC, SG_DEBUG, baseUrl() << " in sync at version " << _d->targetRevision);
_d->isUpdating = false;
return;
}
@@ -375,7 +375,7 @@ void SVNRepoPrivate::propFindComplete(HTTP::Request* req, DAVCollection* c)
void SVNRepoPrivate::propFindFailed(HTTP::Request *req, SVNRepository::ResultCode err)
{
if (err != SVNRepository::SVN_ERROR_NOT_FOUND) {
SG_LOG(SG_IO, SG_WARN, "PropFind failed for:" << req->url());
SG_LOG(SG_TERRASYNC, SG_WARN, "PropFind failed for:" << req->url());
}
isUpdating = false;

View File

@@ -3,9 +3,12 @@
#include <iostream>
#include <map>
#include <sstream>
#include <errno.h>
#include <boost/algorithm/string/case_conv.hpp>
#include <simgear/simgear_config.h>
#include "HTTPClient.hxx"
#include "HTTPRequest.hxx"
@@ -14,6 +17,10 @@
#include <simgear/timing/timestamp.hxx>
#include <simgear/debug/logstream.hxx>
#if defined(ENABLE_CURL)
#include <curl/multi.h>
#endif
using std::cout;
using std::cerr;
using std::endl;
@@ -57,7 +64,8 @@ public:
TestRequest(const std::string& url, const std::string method = "GET") :
HTTP::Request(url, method),
complete(false)
complete(false),
failed(false)
{
}
@@ -666,19 +674,34 @@ int main(int argc, char* argv[])
HTTP::Request_ptr own(tr);
cl.makeRequest(tr);
waitForFailed(&cl, tr);
COMPARE(tr->responseCode(), ENOENT);
#if defined(ENABLE_CURL)
const int HOST_NOT_FOUND_CODE = CURLE_COULDNT_RESOLVE_HOST;
#else
const int HOST_NOT_FOUND_CODE = ENOENT;
#endif
COMPARE(tr->responseCode(), HOST_NOT_FOUND_CODE);
}
cout << "testing abrupt close" << endl;
// test server-side abrupt close
{
TestRequest* tr = new TestRequest("http://localhost:2000/test_abrupt_close");
HTTP::Request_ptr own(tr);
cl.makeRequest(tr);
waitForFailed(&cl, tr);
COMPARE(tr->responseCode(), 500);
#if defined(ENABLE_CURL)
const int SERVER_NO_DATA_CODE = CURLE_GOT_NOTHING;
#else
const int SERVER_NO_DATA_CODE = 500;
#endif
COMPARE(tr->responseCode(), SERVER_NO_DATA_CODE);
}
cout << "testing proxy close" << endl;
// test proxy
{
cl.setProxy("localhost", 2000);

View File

@@ -154,7 +154,7 @@ public:
static bool isNaN(const T& v)
{
#ifdef HAVE_ISNAN
return isnan(v);
return (isnan(v) != 0);
#elif defined HAVE_STD_ISNAN
return std::isnan(v);
#else

View File

@@ -59,7 +59,7 @@ namespace simgear
}
void setMaxSubdiv( size_t aMaxSubdiv ) { mMaxSubdiv = aMaxSubdiv; }
void getMaxSubdiv() const { return mMaxSubdiv; }
size_t getMaxSubdiv() const { return mMaxSubdiv; }
PointList &pointList() { return mPointList; }
const PointList &pointList() const { return mPointList; }

View File

@@ -31,6 +31,7 @@
#include <simgear/package/Package.hxx>
#include <simgear/package/Root.hxx>
#include <simgear/package/Install.hxx>
#include <simgear/misc/strutils.hxx>
namespace simgear {
@@ -40,18 +41,32 @@ bool checkVersion(const std::string& aVersion, SGPropertyNode_ptr props)
{
BOOST_FOREACH(SGPropertyNode* v, props->getChildren("version")) {
std::string s(v->getStringValue());
if (s== aVersion) {
if (s == aVersion) {
return true;
}
// allow 3.5.* to match any of 3.5.0, 3.5.1rc1, 3.5.11 or so on
if (strutils::ends_with(s, ".*")) {
size_t lastDot = aVersion.rfind('.');
std::string ver = aVersion.substr(0, lastDot);
if (ver == s.substr(0, s.length() - 2)) {
return true;
// examine each dot-seperated component in turn, supporting a wildcard
// in the versions from the catalog.
string_list appVersionParts = simgear::strutils::split(aVersion, ".");
string_list catVersionParts = simgear::strutils::split(s, ".");
size_t partCount = appVersionParts.size();
if (partCount != catVersionParts.size()) {
continue;
}
bool ok = true;
for (unsigned int p=0; p < partCount; ++p) {
if (catVersionParts[p] == "*") {
// always passes
} else if (appVersionParts[p] != catVersionParts[p]) {
ok = false;
}
}
if (ok) {
return true;
}
}
return false;
}
@@ -196,22 +211,13 @@ CatalogRef Catalog::createFromPath(Root* aRoot, const SGPath& aPath)
return NULL;
}
if (!checkVersion(aRoot->applicationVersion(), props)) {
std::string redirect = redirectUrlForVersion(aRoot->applicationVersion(), props);
if (!redirect.empty()) {
SG_LOG(SG_GENERAL, SG_WARN, "catalog at " << aPath << ", version mismatch:\n\t"
<< "redirecting to alternate URL:" << redirect);
CatalogRef c = Catalog::createFromUrl(aRoot, redirect);
c->m_installRoot = aPath;
return c;
} else {
SG_LOG(SG_GENERAL, SG_WARN, "skipping catalog at " << aPath << ", version mismatch:\n\t"
<< props->getStringValue("version") << " vs required " << aRoot->catalogVersion());
return NULL;
}
bool versionCheckOk = checkVersion(aRoot->applicationVersion(), props);
if (!versionCheckOk) {
SG_LOG(SG_GENERAL, SG_INFO, "catalog at:" << aPath << " failed version check: need" << aRoot->applicationVersion());
// keep the catalog but mark it as needing an update
} else {
SG_LOG(SG_GENERAL, SG_INFO, "creating catalog from:" << aPath);
SG_LOG(SG_GENERAL, SG_DEBUG, "creating catalog from:" << aPath);
}
CatalogRef c = new Catalog(aRoot);
@@ -219,8 +225,12 @@ CatalogRef Catalog::createFromPath(Root* aRoot, const SGPath& aPath)
c->parseProps(props);
c->parseTimestamp();
// parsed XML ok, mark status as valid
c->changeStatus(Delegate::STATUS_SUCCESS);
if (versionCheckOk) {
// parsed XML ok, mark status as valid
c->changeStatus(Delegate::STATUS_SUCCESS);
} else {
c->changeStatus(Delegate::FAIL_VERSION);
}
return c;
}
@@ -469,6 +479,11 @@ unsigned int Catalog::ageInSeconds() const
bool Catalog::needsRefresh() const
{
// always refresh in these cases
if ((m_status == Delegate::FAIL_VERSION) || (m_status == Delegate::FAIL_DOWNLOAD)) {
return true;
}
unsigned int maxAge = m_props->getIntValue("max-age-sec", m_root->maxAgeSeconds());
return (ageInSeconds() > maxAge);
}

View File

@@ -159,6 +159,7 @@ public:
std::string locale;
HTTP::Client* http;
CatalogDict catalogs;
CatalogList disabledCatalogs;
unsigned int maxAgeSeconds;
std::string version;
@@ -240,10 +241,16 @@ Root::Root(const SGPath& aPath, const std::string& aVersion) :
return;
}
BOOST_FOREACH(SGPath c, dir.children(Dir::TYPE_DIR)) {
BOOST_FOREACH(SGPath c, dir.children(Dir::TYPE_DIR | Dir::NO_DOT_OR_DOTDOT)) {
CatalogRef cat = Catalog::createFromPath(this, c);
if (cat) {
d->catalogs[cat->id()] = cat;
if (cat->status() == Delegate::STATUS_SUCCESS) {
d->catalogs[cat->id()] = cat;
} else {
// catalog has problems, such as needing an update
// keep it out of the main collection for now
d->disabledCatalogs.push_back(cat);
}
}
} // of child directories iteration
}
@@ -357,12 +364,23 @@ Root::packagesNeedingUpdate() const
void Root::refresh(bool aForce)
{
bool didStartAny = false;
// copy all candidate ctalogs to a seperate list, since refreshing
// can modify both the main collection and/or the disabled list
CatalogList toRefresh;
CatalogDict::iterator it = d->catalogs.begin();
for (; it != d->catalogs.end(); ++it) {
if (aForce || it->second->needsRefresh()) {
it->second->refresh();
didStartAny = true;
}
toRefresh.push_back(it->second);
}
toRefresh.insert(toRefresh.end(), d->disabledCatalogs.begin(),
d->disabledCatalogs.end());
CatalogList::iterator j = toRefresh.begin();
for (; j != toRefresh.end(); ++j) {
(*j)->refresh();
didStartAny = true;
}
if (!didStartAny) {
@@ -486,23 +504,39 @@ void Root::catalogRefreshStatus(CatalogRef aCat, Delegate::StatusCode aReason)
d->refreshing.erase(aCat);
}
if ((aReason != Delegate::STATUS_REFRESHED) && (aReason != Delegate::STATUS_IN_PROGRESS)) {
// if the failure is permanent, delete the catalog from our
// list (don't touch it on disk)
bool isPermanentFailure = (aReason == Delegate::FAIL_VERSION);
if (isPermanentFailure) {
SG_LOG(SG_GENERAL, SG_WARN, "permanent failure for catalog:" << aCat->id());
if (catIt != d->catalogs.end()) {
d->catalogs.erase(catIt);
}
}
}
if ((aReason == Delegate::STATUS_REFRESHED) && (catIt == d->catalogs.end())) {
assert(!aCat->id().empty());
d->catalogs.insert(catIt, CatalogDict::value_type(aCat->id(), aCat));
// catalog might have been previously disabled, let's remove in that case
CatalogList::iterator j = std::find(d->disabledCatalogs.begin(),
d->disabledCatalogs.end(),
aCat);
if (j != d->disabledCatalogs.end()) {
SG_LOG(SG_GENERAL, SG_INFO, "re-enabling disabled catalog:" << aCat->id());
d->disabledCatalogs.erase(j);
}
}
if ((aReason != Delegate::STATUS_REFRESHED) &&
(aReason != Delegate::STATUS_IN_PROGRESS) &&
(aReason != Delegate::STATUS_SUCCESS))
{
// catalog has errors, disable it
CatalogList::iterator j = std::find(d->disabledCatalogs.begin(),
d->disabledCatalogs.end(),
aCat);
if (j == d->disabledCatalogs.end()) {
SG_LOG(SG_GENERAL, SG_INFO, "disabling catalog:" << aCat->id());
d->disabledCatalogs.push_back(aCat);
}
// and remove it from the active collection
if (catIt != d->catalogs.end()) {
d->catalogs.erase(catIt);
}
} // of catalog has errors case
if (d->refreshing.empty()) {
d->fireRefreshStatus(CatalogRef(), Delegate::STATUS_REFRESHED);
d->firePackagesChanged();
@@ -511,17 +545,31 @@ void Root::catalogRefreshStatus(CatalogRef aCat, Delegate::StatusCode aReason)
bool Root::removeCatalogById(const std::string& aId)
{
CatalogRef cat;
CatalogDict::iterator catIt = d->catalogs.find(aId);
if (catIt == d->catalogs.end()) {
SG_LOG(SG_GENERAL, SG_WARN, "removeCatalogById: unknown ID:" << aId);
return false;
// check the disabled list
CatalogList::iterator j = d->disabledCatalogs.begin();
for (; j != d->disabledCatalogs.end(); ++j) {
if ((*j)->id() == aId) {
break;
}
}
if (j == d->disabledCatalogs.end()) {
SG_LOG(SG_GENERAL, SG_WARN, "removeCatalogById: no catalog with id:" << aId);
return false;
}
cat = *j;
d->disabledCatalogs.erase(j);
} else {
cat = catIt->second;
// drop the reference
d->catalogs.erase(catIt);
}
CatalogRef cat = catIt->second;
// drop the reference
d->catalogs.erase(catIt);
bool ok = cat->uninstall();
if (!ok) {
SG_LOG(SG_GENERAL, SG_WARN, "removeCatalogById: catalog :" << aId

View File

@@ -97,7 +97,7 @@ public:
virtual ~SGTileDetailsCallback()
{
num_tdcb--;
SG_LOG( SG_GENERAL, SG_INFO, "SGTileDetailsCallback::~SGTileDetailsCallback() num cbs left " << num_tdcb );
SG_LOG( SG_TERRAIN, SG_DEBUG, "SGTileDetailsCallback::~SGTileDetailsCallback() num cbs left " << num_tdcb );
}
virtual osgDB::ReaderWriter::ReadResult readNode(

View File

@@ -51,6 +51,7 @@
#include <map>
#include <simgear/compiler.h>
#include <simgear/version.h>
#include "terrasync.hxx"
@@ -228,7 +229,7 @@ protected:
virtual void onFail()
{
SG_LOG(SG_TERRAIN, SG_ALERT, "Failed to query TerraSync SVN server");
SG_LOG(SG_TERRASYNC, SG_ALERT, "Failed to query TerraSync SVN server");
HTTP::Request::onFail();
}
@@ -343,7 +344,7 @@ SGTerraSync::SvnThread::SvnThread() :
_stop(false),
_use_svn(true)
{
_http.setUserAgent("terrascenery-" SG_STRINGIZE(SG_VERSION));
_http.setUserAgent("terrascenery-" SG_STRINGIZE(SIMGEAR_VERSION));
}
void SGTerraSync::SvnThread::stop()
@@ -369,7 +370,7 @@ bool SGTerraSync::SvnThread::start()
if (_local_dir=="")
{
SG_LOG(SG_TERRAIN,SG_ALERT,
SG_LOG(SG_TERRASYNC,SG_ALERT,
"Cannot start scenery download. Local cache directory is undefined.");
_fail_count++;
_stalled = true;
@@ -379,7 +380,7 @@ bool SGTerraSync::SvnThread::start()
SGPath path(_local_dir);
if (!path.exists())
{
SG_LOG(SG_TERRAIN,SG_ALERT,
SG_LOG(SG_TERRASYNC,SG_ALERT,
"Cannot start scenery download. Directory '" << _local_dir <<
"' does not exist. Set correct directory path or create directory folder.");
_fail_count++;
@@ -390,7 +391,7 @@ bool SGTerraSync::SvnThread::start()
path.append("version");
if (path.exists())
{
SG_LOG(SG_TERRAIN,SG_ALERT,
SG_LOG(SG_TERRASYNC,SG_ALERT,
"Cannot start scenery download. Directory '" << _local_dir <<
"' contains the base package. Use a separate directory.");
_fail_count++;
@@ -403,7 +404,7 @@ bool SGTerraSync::SvnThread::start()
if ((!_use_svn)&&(_rsync_server==""))
{
SG_LOG(SG_TERRAIN,SG_ALERT,
SG_LOG(SG_TERRASYNC,SG_ALERT,
"Cannot start scenery download. Rsync scenery server is undefined.");
_fail_count++;
_stalled = true;
@@ -435,7 +436,7 @@ bool SGTerraSync::SvnThread::start()
// not really an alert - but we want to (always) see this message, so user is
// aware we're downloading scenery (and using bandwidth).
SG_LOG(SG_TERRAIN,SG_ALERT,
SG_LOG(SG_TERRASYNC,SG_ALERT,
"Starting automatic scenery download/synchronization. "
<< status
<< "Directory: '" << _local_dir << "'.");
@@ -475,7 +476,7 @@ bool SGTerraSync::SvnThread::runExternalSyncCommand(const char* dir)
#else
command = buf.str();
#endif
SG_LOG(SG_TERRAIN,SG_DEBUG, "sync command '" << command << "'");
SG_LOG(SG_TERRASYNC,SG_DEBUG, "sync command '" << command << "'");
#ifdef SG_WINDOWS
// tbd: does Windows support "popen"?
@@ -490,7 +491,7 @@ bool SGTerraSync::SvnThread::runExternalSyncCommand(const char* dir)
if (rc)
{
SG_LOG(SG_TERRAIN,SG_ALERT,
SG_LOG(SG_TERRASYNC,SG_ALERT,
"Failed to synchronize directory '" << dir << "', " <<
"error code= " << rc);
return false;
@@ -505,7 +506,7 @@ void SGTerraSync::SvnThread::run()
{
if (_svn_server.empty()) {
SG_LOG(SG_TERRAIN,SG_INFO, "Querying closest TerraSync server");
SG_LOG(SG_TERRASYNC,SG_INFO, "Querying closest TerraSync server");
ServerSelectQuery* ssq = new ServerSelectQuery;
HTTP::Request_ptr req = ssq;
_http.makeRequest(req);
@@ -515,12 +516,12 @@ void SGTerraSync::SvnThread::run()
if (req->readyState() == HTTP::Request::DONE) {
_svn_server = ssq->svnUrl();
SG_LOG(SG_TERRAIN,SG_INFO, "Closest TerraSync server:" << _svn_server);
SG_LOG(SG_TERRASYNC,SG_INFO, "Closest TerraSync server:" << _svn_server);
} else {
SG_LOG(SG_TERRAIN,SG_WARN, "Failed to query closest TerraSync server");
SG_LOG(SG_TERRASYNC,SG_WARN, "Failed to query closest TerraSync server");
}
} else {
SG_LOG(SG_TERRAIN,SG_INFO, "Explicit: TerraSync server:" << _svn_server);
SG_LOG(SG_TERRASYNC,SG_INFO, "Explicit: TerraSync server:" << _svn_server);
}
if (_svn_server.empty()) {
@@ -551,7 +552,7 @@ void SGTerraSync::SvnThread::runExternal()
SyncItem::Status cacheStatus = isPathCached(next);
if (cacheStatus != SyncItem::Invalid) {
_cache_hits++;
SG_LOG(SG_TERRAIN, SG_DEBUG,
SG_LOG(SG_TERRASYNC, SG_DEBUG,
"Cache hit for: '" << next._dir << "'");
next._status = cacheStatus;
_freshTiles.push_back(next);
@@ -581,7 +582,7 @@ void SGTerraSync::SvnThread::syncPathExternal(const SyncItem& next)
if (isNewDirectory) {
int rc = path.create_dir( 0755 );
if (rc) {
SG_LOG(SG_TERRAIN,SG_ALERT,
SG_LOG(SG_TERRASYNC,SG_ALERT,
"Cannot create directory '" << path << "', return code = " << rc );
throw sg_exception("Cannot create directory for terrasync", path.str());
}
@@ -606,8 +607,8 @@ void SGTerraSync::SvnThread::updateSyncSlot(SyncSlot &slot)
if (slot.repository->isDoingSync()) {
#if 1
if (slot.stamp.elapsedMSec() > (int)slot.nextWarnTimeout) {
SG_LOG(SG_TERRAIN, SG_INFO, "sync taking a long time:" << slot.currentItem._dir << " taken " << slot.stamp.elapsedMSec());
SG_LOG(SG_TERRAIN, SG_INFO, "HTTP request count:" << _http.hasActiveRequests());
SG_LOG(SG_TERRASYNC, SG_INFO, "sync taking a long time:" << slot.currentItem._dir << " taken " << slot.stamp.elapsedMSec());
SG_LOG(SG_TERRASYNC, SG_INFO, "HTTP request count:" << _http.hasActiveRequests());
slot.nextWarnTimeout += 10000;
}
#endif
@@ -622,7 +623,7 @@ void SGTerraSync::SvnThread::updateSyncSlot(SyncSlot &slot)
fail(slot.currentItem);
} else {
updated(slot.currentItem, slot.isNewDirectory);
SG_LOG(SG_TERRAIN, SG_DEBUG, "sync of " << slot.repository->baseUrl() << " finished ("
SG_LOG(SG_TERRASYNC, SG_DEBUG, "sync of " << slot.repository->baseUrl() << " finished ("
<< slot.stamp.elapsedMSec() << " msec");
}
@@ -642,7 +643,7 @@ void SGTerraSync::SvnThread::updateSyncSlot(SyncSlot &slot)
if (slot.isNewDirectory) {
int rc = path.create_dir( 0755 );
if (rc) {
SG_LOG(SG_TERRAIN,SG_ALERT,
SG_LOG(SG_TERRASYNC,SG_ALERT,
"Cannot create directory '" << path << "', return code = " << rc );
fail(slot.currentItem);
return;
@@ -661,7 +662,7 @@ void SGTerraSync::SvnThread::updateSyncSlot(SyncSlot &slot)
slot.nextWarnTimeout = 20000;
slot.stamp.stamp();
slot.busy = true;
SG_LOG(SG_TERRAIN, SG_INFO, "sync of " << slot.repository->baseUrl() << " started, queue size is " << slot.queue.size());
SG_LOG(SG_TERRASYNC, SG_INFO, "sync of " << slot.repository->baseUrl() << " started, queue size is " << slot.queue.size());
}
}
@@ -682,7 +683,7 @@ void SGTerraSync::SvnThread::runInternal()
SyncItem::Status cacheStatus = isPathCached(next);
if (cacheStatus != SyncItem::Invalid) {
_cache_hits++;
SG_LOG(SG_TERRAIN, SG_DEBUG, "\nTerraSync Cache hit for: '" << next._dir << "'");
SG_LOG(SG_TERRASYNC, SG_DEBUG, "\nTerraSync Cache hit for: '" << next._dir << "'");
next._status = cacheStatus;
_freshTiles.push_back(next);
_is_dirty = true;
@@ -739,8 +740,8 @@ void SGTerraSync::SvnThread::fail(SyncItem failedItem)
_fail_count++;
failedItem._status = SyncItem::Failed;
_freshTiles.push_back(failedItem);
SG_LOG(SG_TERRAIN,SG_INFO,
"Faield to sync'" << failedItem._dir << "'");
SG_LOG(SG_TERRASYNC,SG_INFO,
"Failed to sync'" << failedItem._dir << "'");
_completedTiles[ failedItem._dir ] = now + UpdateInterval::FailedAttempt;
_is_dirty = true;
}
@@ -765,7 +766,7 @@ void SGTerraSync::SvnThread::updated(SyncItem item, bool isNewDirectory)
time_t now = time(0);
_consecutive_errors = 0;
_success_count++;
SG_LOG(SG_TERRAIN,SG_INFO,
SG_LOG(SG_TERRASYNC,SG_INFO,
"Successfully synchronized directory '" << item._dir << "'");
item._status = SyncItem::Updated;
@@ -791,7 +792,7 @@ void SGTerraSync::SvnThread::initCompletedTilesPersistentCache()
try {
readProperties(_persistentCachePath.str(), cacheRoot);
} catch (sg_exception& e) {
SG_LOG(SG_TERRAIN, SG_INFO, "corrupted persistent cache, discarding");
SG_LOG(SG_TERRASYNC, SG_INFO, "corrupted persistent cache, discarding");
return;
}
@@ -852,7 +853,7 @@ SGTerraSync::SGTerraSync() :
_inited(false)
{
_svnThread = new SvnThread();
_log = new BufferedLogCallback(SG_TERRAIN, SG_INFO);
_log = new BufferedLogCallback(SG_TERRASYNC, SG_INFO);
_log->truncateAt(255);
sglog().addCallback(_log);
@@ -977,13 +978,13 @@ void SGTerraSync::update(double)
{
if (_svnThread->_stalled)
{
SG_LOG(SG_TERRAIN,SG_ALERT,
SG_LOG(SG_TERRASYNC,SG_ALERT,
"Automatic scenery download/synchronization stalled. Too many errors.");
}
else
{
// not really an alert - just always show this message
SG_LOG(SG_TERRAIN,SG_ALERT,
SG_LOG(SG_TERRASYNC,SG_ALERT,
"Automatic scenery download/synchronization has stopped.");
}
_stalledNode->setBoolValue(_svnThread->_stalled);

View File

@@ -234,6 +234,7 @@ SGSubsystemGroup::update (double delta_time_sec)
if ((delta_time_sec > 0.0) && (_fixedUpdateTime > 0.0)) {
double localDelta = delta_time_sec + _updateTimeRemainder;
loopCount = SGMiscd::roundToInt(localDelta / _fixedUpdateTime);
loopCount = std::max(0, loopCount);
_updateTimeRemainder = delta_time_sec - (loopCount * _fixedUpdateTime);
delta_time_sec = _fixedUpdateTime;
}

View File

@@ -170,13 +170,6 @@ static double sidereal_course( time_t cur_time, const struct tm *gmt, double lng
return lstTmp;
}
/** Deprecated method. To be removed after the next release... */
void SGTime::update( double lon_rad, double lat_rad, time_t ct, long int warp )
{
const SGGeod& location = SGGeod::fromRad(lon_rad, lat_rad);
update(location, ct, warp);
}
// Update the time related variables
void SGTime::update( const SGGeod& location, time_t ct, long int warp )
{

View File

@@ -151,9 +151,6 @@ public:
*/
void update( const SGGeod& location, time_t ct, long int warp );
/** Deprecated method. To be removed after the next release... */
void update( double lon_rad, double lat_rad, time_t ct, long int warp ) DEPRECATED;
/**
* Given lon/lat, update timezone information and local_offset
* The updateLocal() method is intended to be called less

View File

@@ -1 +1 @@
2016.1.0
2016.1.2