diff options
| author | Martin Ridgers <[email protected]> | 2021-11-17 13:51:15 +0100 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2021-11-17 13:51:15 +0100 |
| commit | b4c04c87a8d5bf9d61b8ca5dbd2f4bb3e9fe20b1 (patch) | |
| tree | 8cf0e4b589d2d0b16cfebb12f9cba8dba19fafee /zenserver/upstream/zen.cpp | |
| parent | Submitted some debug printing in error (diff) | |
| parent | Check both success and error code when initializing Jupiter upstream. (diff) | |
| download | zen-b4c04c87a8d5bf9d61b8ca5dbd2f4bb3e9fe20b1.tar.xz zen-b4c04c87a8d5bf9d61b8ca5dbd2f4bb3e9fe20b1.zip | |
Merged main
Diffstat (limited to 'zenserver/upstream/zen.cpp')
| -rw-r--r-- | zenserver/upstream/zen.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/zenserver/upstream/zen.cpp b/zenserver/upstream/zen.cpp index fe3338d52..cd7f48334 100644 --- a/zenserver/upstream/zen.cpp +++ b/zenserver/upstream/zen.cpp @@ -311,17 +311,17 @@ namespace detail { ZenCacheSessionState(ZenStructuredCacheClient& Client) : OwnerClient(Client) {} ~ZenCacheSessionState() {} - void Reset() {} - - cpr::Session& GetSession() + void Reset(std::chrono::milliseconds ConnectTimeout, std::chrono::milliseconds Timeout) { - OwnerClient.InitializeSessionState(*this); - return Session; + Session.SetBody({}); + Session.SetHeader({}); + Session.SetConnectTimeout(ConnectTimeout); + Session.SetTimeout(Timeout); } - private: - friend class zen::ZenStructuredCacheClient; + cpr::Session& GetSession() { return Session; } + private: ZenStructuredCacheClient& OwnerClient; cpr::Session Session; }; @@ -330,7 +330,7 @@ namespace detail { ////////////////////////////////////////////////////////////////////////// -ZenStructuredCacheClient::ZenStructuredCacheClient(const ZenClientOptions& Options) +ZenStructuredCacheClient::ZenStructuredCacheClient(const ZenStructuredCacheClientOptions& Options) : m_Log(logging::Get(std::string_view("zenclient"))) , m_ServiceUrl(Options.Url) , m_ConnectTimeout(Options.ConnectTimeout) @@ -358,7 +358,7 @@ ZenStructuredCacheClient::AllocSessionState() State = new detail::ZenCacheSessionState(*this); } - State->Reset(); + State->Reset(m_ConnectTimeout, m_Timeout); return State; } @@ -370,13 +370,6 @@ ZenStructuredCacheClient::FreeSessionState(detail::ZenCacheSessionState* State) m_SessionStateCache.push_front(State); } -void -ZenStructuredCacheClient::InitializeSessionState(detail::ZenCacheSessionState& State) -{ - State.Session.SetConnectTimeout(m_ConnectTimeout); - State.Session.SetTimeout(m_Timeout); -} - ////////////////////////////////////////////////////////////////////////// using namespace std::literals; |