diff --git a/apps/evo-server/main.cpp b/apps/evo-server/main.cpp index 6c2118d..07bfb6b 100644 --- a/apps/evo-server/main.cpp +++ b/apps/evo-server/main.cpp @@ -483,10 +483,10 @@ template int serve(Options& o) { admission_name(admitted.error())); pending.reset(); } - const bool m10_accepting = m10->accepting(static_cast( - std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()) - .count())); + const bool m10_accepting = m10->accepting( + static_cast(std::chrono::duration_cast( + std::chrono::system_clock::now().time_since_epoch()) + .count())); if (o.synthetic && !drain_deadline && (!m10->enabled() || m10_accepting)) { const auto& now_status = host.status(); const bool running = now_status.phase == server::HostPhase::running && now_status.ready; diff --git a/include/evo/server/session_window.hpp b/include/evo/server/session_window.hpp index 0a642a3..e7171bf 100644 --- a/include/evo/server/session_window.hpp +++ b/include/evo/server/session_window.hpp @@ -18,12 +18,13 @@ class SessionWindow { static constexpr std::uint64_t max_duration_seconds = 30 * 60; static std::expected open(std::string_view specification, - std::uint64_t now_seconds) { + std::uint64_t now_seconds) { const auto colon = specification.rfind(':'); if (colon == std::string_view::npos || colon == 0 || colon + 1 == specification.size()) return std::unexpected(Error::malformed); const auto id = specification.substr(0, colon); - if (id.find_first_not_of("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._-") != + if (id.find_first_not_of( + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz._-") != std::string_view::npos) return std::unexpected(Error::malformed); std::uint64_t deadline{}; @@ -45,10 +46,18 @@ class SessionWindow { } return true; } - [[nodiscard]] bool closed() const noexcept { return closed_; } - [[nodiscard]] std::uint64_t deadline_seconds() const noexcept { return deadline_seconds_; } - [[nodiscard]] const std::string& activation_id() const noexcept { return activation_id_; } - void close() noexcept { closed_ = true; } + [[nodiscard]] bool closed() const noexcept { + return closed_; + } + [[nodiscard]] std::uint64_t deadline_seconds() const noexcept { + return deadline_seconds_; + } + [[nodiscard]] const std::string& activation_id() const noexcept { + return activation_id_; + } + void close() noexcept { + closed_ = true; + } private: SessionWindow(std::string activation_id, std::uint64_t deadline_seconds) diff --git a/tests/region_m10_session_tests.cpp b/tests/region_m10_session_tests.cpp index 33b9b89..7657db2 100644 --- a/tests/region_m10_session_tests.cpp +++ b/tests/region_m10_session_tests.cpp @@ -90,11 +90,17 @@ struct Setup { expect(issuer.has_value(), "issuer key"); } [[nodiscard]] std::vector args() const { - return server_args(region, - {"--synthetic-inputs", "development-v1", "--m10-listen", "127.0.0.1:0", - "--m10-cert", (region.root / "server.pem").string(), "--m10-key", - (region.root / "server.key").string(), "--m10-issuer", - (region.root / "issuer.pub").string(), "--m10-environment", "dev", "--session-window", "test-" + std::to_string(static_cast(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()) + 1200)}); + return server_args( + region, + {"--synthetic-inputs", "development-v1", "--m10-listen", "127.0.0.1:0", "--m10-cert", + (region.root / "server.pem").string(), "--m10-key", + (region.root / "server.key").string(), "--m10-issuer", + (region.root / "issuer.pub").string(), "--m10-environment", "dev", "--session-window", + "test-" + std::to_string(static_cast( + std::chrono::duration_cast( + std::chrono::system_clock::now().time_since_epoch()) + .count()) + + 1200)}); } [[nodiscard]] WireGrant grant(const AccountId& who, std::uint64_t serial) const { GrantClaims c;