Commit Graph

4531 Commits

Author SHA1 Message Date
Florent Rougon
61e2d2dd3b Fix missing include in simgear/misc/strutils.cxx
Thanks to Alan Teeder for the report.
2016-05-09 16:03:37 +02:00
Torsten Dreyer
2523236cec Merge /u/frougon/flightgear-simgear/ branch thread-safe-alternative-to-strerror into next
https://sourceforge.net/p/flightgear/simgear/merge-requests/9/
2016-05-09 10:51:13 +00:00
Torsten Dreyer
1c182ff69d Merge /u/psadro/simgear/ branch terragear-changes into next
https://sourceforge.net/p/flightgear/simgear/merge-requests/8/
2016-05-09 10:47:04 +00:00
Florent Rougon
757970fe41 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).
2016-05-08 23:28:01 +02:00
Peter Sadrozinski
6e904ba1aa add siblings function to bucket.
At some latitudes, buckets can have multiple siblings.
2016-05-07 07:43:22 -04:00
James Turner
616826ab69 Remove non-CURL HTTP option. 2016-05-07 10:11:40 +01:00
James Turner
6e4da15a58 Use SGBinaryFile in a couple more places.
Most importantly, when computing a hash from the on-disk
state.
2016-05-07 10:03:48 +01:00
Torsten Dreyer
561e451192 Introduce SGBinaryFile
For Windows, default file mode is TEXT.
If binary files should be created _O_BINARY shall be or'ed to the open
flags. This is not necessary on *nixes.

Introduce a SGBinaryFile as extension to SGFile which adds the flag
upon construction on Windows.

This should keep existing behaviour for all other usages of SGFile.
2016-05-06 22:01:42 +02:00
Torsten Dreyer
74b4df9452 Don't use object returned from vector::end()
Replace all use of c->name by it->file() in
updateChildrenBasedOnHash()'s fsChildren loop
to avoid confusion.

Thanks to Geoff for spotting this!
2016-05-06 16:21:43 +02:00
Torsten Dreyer
862980a67a Remove unneeded local scope
(no functional change intended)
2016-05-06 16:20:09 +02:00
Torsten Dreyer
5fb8891e86 Fix one more crash on Windows in HTTPRepository
inner scope it seems to overwrite out scope it on Win :-/

Anyway, the erase-remove-idiom is a better solution for that task
https://en.wikipedia.org/wiki/Erase%E2%80%93remove_idiom

Also remove some useless debug messages
2016-05-06 10:48:16 +02:00
Torsten Dreyer
f3d68a170e Don't continue parsing after processing version line 2016-05-05 21:59:35 +02:00
James Turner
1fe8931129 Packages: fix extract dir cleanup on success.
Don’t leave extract_xxxxxxx dirs in the Aircraft tree after successfully
extract the contents to the final location.
2016-05-04 22:22:34 +01:00
James Turner
d39b055ed1 Avoid unlink of an open file.
Works on Unix, not so great on Windows it turns out. Thanks to Jasin
and Geoff for figuring this out in the end.
2016-05-04 22:13:15 +01:00
Torsten Dreyer
639e16b722 use safer stl functions instead of pointer operations 2016-05-04 21:10:12 +02:00
Torsten Dreyer
9456ff838c Add a bunch of debug messages to help fixing the Windows crash
This patch should be reverted once the bug is fixed
2016-05-04 15:44:55 +02:00
Torsten Dreyer
eac3402176 Enable DNS resolver code by default 2016-05-03 14:58:38 +02:00
Torsten Dreyer
9a29f54f8a 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
2016-05-03 12:11:38 +02:00
Torsten Dreyer
5e7b5cbf68 udns: fix self baked inet_pton 2016-05-03 09:43:56 +02:00
Torsten Dreyer
bba11c18d1 Fix Nasal math.clamp()
Thanks to "Red Leader" from the forum for spotting
2016-05-02 21:57:35 +02:00
Torsten Dreyer
379a171d24 Use simgear sleep instead of usleep 2016-05-02 21:25:19 +02:00
Torsten Dreyer
87eaec3ce7 Fix some warnings reported from msvc 2016-05-02 20:54:28 +02:00
Torsten Dreyer
b5dace5f08 Fix Windows build (hopefully) 2016-05-02 20:46:42 +02:00
Torsten Dreyer
5ecf07e92d udns: add missing config.h 2016-05-02 20:27:04 +02:00
Torsten Dreyer
53d8dcfc77 Try fix windows compile for udns 2016-05-02 17:42:01 +02:00
Torsten Dreyer
6b31646d61 Hardening the DNSClient code
- add a timeout to avoid deadlock without a dns server
- test against existing terrasync.flightgear.org RR's
2016-05-02 16:21:42 +02:00
Stuart Buchanan
06f888d38c 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.
2016-05-01 22:35:21 +01:00
Torsten Dreyer
51ad61061f Fix broken build/install with DNS enabled 2016-04-28 10:50:15 +02:00
Torsten Dreyer
ff5b09c97b Initial commit for a DNS service resolver
- import udns library
  (http://www.corpit.ru/mjt/udns.html)
- initial draft for a DNSClient (derived from HTTPClient)

Enable compile and test by adding -D ENABLE_DNS=Yes to cmake flags
2016-04-28 09:37:08 +02:00
James Turner
46ed4b2f79 Catalog refresh / package updating test. 2016-04-20 11:58:35 +02:00
James Turner
8582676100 Catalog removal test
- verifies installed packages are removed also.
2016-04-19 13:56:07 +02:00
James Turner
32181a3956 Expand package-system unit-tests.
More to come, but this covers the absolute basics now.
2016-04-19 13:50:37 +02:00
James Turner
c17324b5ea Fixes for HTTP cancellation.
(Forgot to stage these from previous commit)
2016-04-14 09:42:04 +01:00
James Turner
a3f1bb546f HTTP request cancellation
- replaces abort() with something more structured.
2016-04-14 09:16:36 +01:00
Stuart Buchanan
493aab8bab Make LOD for buildings/trees/STG configurable.
Now based on /sim/rendering/static-lod/rough.
2016-04-08 22:36:06 +01:00
Richard Senior
92a51059b4 Fix problems parsing METAR strings that denote temporary sensor failures
1. Weather (normally blank, RA, SN, etc.) can be "//"
2. Cloud can be suffixed by "///", e.g. FEW045///

Also updated unit test.
2016-04-05 12:12:04 +01:00
James Turner
177c5ec709 Guard against disabling a not-yet-active catalog. 2016-03-30 17:09:51 +01:00
Erik Hofman
63b2b04977 Code cleanups and fix codecPCM16 for big-endian systems (they seem rare these days) 2016-03-28 15:08:28 +02:00
James Turner
2e1f01a86a Use ref-ptr in canvas adapter getImage
Adjusted while investigating missing tooltip texture with recent
OSG versions.
2016-03-26 19:55:37 +00:00
James Turner
27baafab0d 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-03-25 23:04:45 +00:00
James Turner
8ddcef9142 Fix HTTP unit-test 2016-03-25 13:28:24 +00:00
James Turner
aa679ffb86 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.
2016-03-24 19:15:20 +00:00
James Turner
4fdcfb8623 HTTP/curl - pick up sleep value 2016-03-24 18:41:30 +00:00
James Turner
c199c95218 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.
2016-03-22 21:14:17 +00:00
James Turner
3f9b6d632e HTTP/curl - transfer byte metric work
Should fix the missing download rate feedback on the splash screen
and terra sync dialog.
2016-03-22 21:13:22 +00:00
James Turner
714a6ac47d Disable HTTP pipelining if the connection closes.
Don’t keep attempting to pipeline if the next server sets Close on
its response, since this just generates needless overhead.
2016-03-22 20:06:22 +00:00
James Turner
2438dd8a08 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.
2016-03-05 09:53:37 +00:00
James Turner
49146f41e3 Expose more pipelining controls on HTTP code
- used for both implementations, restrict default pipeline depth to
  5 instead of 32 which was perhaps a little ambitious for some
  servers.
2016-03-01 12:44:22 +00:00
James Turner
8009a33b26 Fix attempt to remove missing files. 2016-03-01 12:35:08 +00:00
James Turner
b8d07cc460 Fixes for error handling in NetChannel
- return the correct errno value instead of using -1
2016-03-01 12:34:56 +00:00