diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2016-08-31 16:43:33 +0200 |
---|---|---|
committer | Ivo van Dongen <info@ivovandongen.nl> | 2016-09-13 14:21:37 +0200 |
commit | 290bd07a92d7103c67f606c1423785069fc9b776 (patch) | |
tree | 00fa0a654830f3cf239932f266e311cab6ebeb59 /include | |
parent | fdaf26b2c02afa6042876962f92b1eaf0ada19bb (diff) | |
download | qtlocation-mapboxgl-290bd07a92d7103c67f606c1423785069fc9b776.tar.gz |
[core] OnlineFileSource - rate limit
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/storage/response.hpp | 6 | ||||
-rw-r--r-- | include/mbgl/util/chrono.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/util/constants.hpp | 2 |
3 files changed, 9 insertions, 1 deletions
diff --git a/include/mbgl/storage/response.hpp b/include/mbgl/storage/response.hpp index 4dc3f36681..448423c1cb 100644 --- a/include/mbgl/storage/response.hpp +++ b/include/mbgl/storage/response.hpp @@ -2,6 +2,7 @@ #include <mbgl/util/chrono.hpp> #include <mbgl/util/optional.hpp> +#include <mbgl/util/variant.hpp> #include <string> #include <memory> @@ -45,15 +46,18 @@ public: NotFound = 2, Server = 3, Connection = 4, + RateLimit = 5, Other = 6, } reason = Reason::Other; // An error message from the request handler, e.g. a server message or a system message // informing the user about the reason for the failure. std::string message; + + optional<Timestamp> retryAfter; public: - Error(Reason, std::string = ""); + Error(Reason, std::string = "", optional<Timestamp> = {}); }; std::ostream& operator<<(std::ostream&, Response::Error::Reason); diff --git a/include/mbgl/util/chrono.hpp b/include/mbgl/util/chrono.hpp index 48460d3377..4adf030331 100644 --- a/include/mbgl/util/chrono.hpp +++ b/include/mbgl/util/chrono.hpp @@ -29,6 +29,8 @@ std::string rfc1123(Timestamp); std::string iso8601(Timestamp); Timestamp parseTimestamp(const char *); + +Timestamp parseTimestamp(const int32_t timestamp); // C++17 polyfill template <class Rep, class Period, class = std::enable_if_t< diff --git a/include/mbgl/util/constants.hpp b/include/mbgl/util/constants.hpp index 3c0b3eb93e..75a1ace5c5 100644 --- a/include/mbgl/util/constants.hpp +++ b/include/mbgl/util/constants.hpp @@ -42,6 +42,8 @@ constexpr Duration DEFAULT_FADE_DURATION = Milliseconds(300); constexpr Seconds CLOCK_SKEW_RETRY_TIMEOUT { 30 }; constexpr UnitBezier DEFAULT_TRANSITION_EASE = { 0, 0, 0.25, 1 }; + +constexpr int DEFAULT_RATE_LIMIT_TIMEOUT = 5; } // namespace util |