Florent Rougon [Fri, 13 May 2016 09:49:33 +0000 (11:49 +0200)]
Use _WIN32 instead of SG_WINDOWS for tests in simgear::strutils::error_string()
Since Cygwin has SG_WINDOWS defined but is likely to expose a POSIX or
GNU-like interface, using _WIN32 to decide whether Windows-specific
functions are available seems more appropriate than SG_WINDOWS to me.
Florent Rougon [Mon, 9 May 2016 14:37:09 +0000 (16:37 +0200)]
Fix missing include in simgear/misc/strutils_test.cxx
strutils_test.cxx uses std::string but doesn't include <string>
directly. This doesn't cause any error because it includes this header
indirectly via "strutils.hxx". However, I believe relying on this is bad
practice, hence the tiny fix.
Florent Rougon [Sun, 8 May 2016 19:45:01 +0000 (21:45 +0200)]
Thread-safe alternative to strerror()
Uses:
- strerror_s() on Windows;
- the GNU strerror_r() on non-Windows systems where _GNU_SOURCE is
defined (which is currently the case when the GNU libstdc++ is used,
even if one doesn't explicitely define _GNU_SOURCE, cf.
<https://gcc.gnu.org/onlinedocs/libstdc++/faq.html#faq.predefined>);
- the XSI-compliant strerror_r() on other systems, as long as
_POSIX_C_SOURCE >= 200112L (otherwise, the compilation will abort
due to a #error preprocessor instruction).
Torsten Dreyer [Tue, 3 May 2016 10:11:38 +0000 (12:11 +0200)]
Terrasync: implement HTTP service lookup via DNS
Let terrasync use the http repository if
/sim/terrasync/http-server == "automatic"
resolve DNS NAPTR RR for terrasync.flightgear.org with service "ws20"
and flags "U". Pick one of the returned entries with lowest order
and preference. If more than one entry with the same order and
preference is returned, pick a random entry of those returned.
or if
/sim/terrasync/http-server != "automatic"
explicitly use the value of that property as the http server
if
/sim/terrasync/http-server is empty, fall back to the legacy
SVN repository
Stuart Buchanan [Sun, 1 May 2016 21:35:21 +0000 (22:35 +0100)]
Display random objects independently of buildings
Fix bug reported by Thorsten RENK on the mailing list
that random objects were only being displayed if random
objects were also present for the tile. Also fix crash
if none of the random object models were found.
James Turner [Fri, 25 Mar 2016 23:04:45 +0000 (23:04 +0000)]
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.
James Turner [Thu, 24 Mar 2016 19:15:20 +0000 (19:15 +0000)]
HTTP terra sync: fix hash cache handling
Avoids very long pauses blocking the terrasync thread, while existing
file trees are verified.
Also split the request queue so we don’t submit vary large numbers of
requests from a single repository, and hence block other repositories
from getting traffic.
James Turner [Tue, 22 Mar 2016 21:14:17 +0000 (21:14 +0000)]
Expose total bytes to download / remaining
For HTTP repositories, support some additional metrics about ongoing
transfers. Not currently exposed via properties / TerraSync API, but
will be shortly.
James Turner [Sat, 5 Mar 2016 09:53:37 +0000 (09:53 +0000)]
Disable persistent TerraSync cache for HTTP
- since the root-level request for an HTTP repo is small, and static,
it doesn’t make sense to use the same persistent cache, especially
for initial testing.
James Turner [Tue, 26 Jan 2016 00:29:25 +0000 (18:29 -0600)]
HTTP repository implementation
A plain-HTTP terrasync repository implementation, using the
SimGear HTTP abstraction. File validity is based on SHA hashes,
and existing files are not re-downloaded if their hash matches,
so soft upgrade from an SVN checkout is possible.
James Turner [Sun, 3 Jan 2016 17:58:22 +0000 (11:58 -0600)]
Fixes for stalling scenery downloads.
- handle closed connections equivalent to IDLE, for timeout purposes
- if the server closes the socket in WAITING_FOR_RESPONSE state, fail
the first sent request when restoring.
Note this does not explain why the server sometimes closes the socket
in this way, but at least it now causes a detectable failure.