diff options
| author | Dan Engelbrecht <[email protected]> | 2022-08-19 03:30:54 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-08-19 03:30:54 -0700 |
| commit | 606274a83d71928f8621c1d23648a26e8f79fa7d (patch) | |
| tree | d951d51e1a7919463aeec398612e97b47f99f788 /zenserver/upstream/zen.cpp | |
| parent | bump vcpkg version to 2022.08.15 (#146) (diff) | |
| download | zen-606274a83d71928f8621c1d23648a26e8f79fa7d.tar.xz zen-606274a83d71928f8621c1d23648a26e8f79fa7d.zip | |
De/fix crash on non responding upstream (#145)
* Fix ZenStructuredCacheClient lifetime issues
Diffstat (limited to 'zenserver/upstream/zen.cpp')
| -rw-r--r-- | zenserver/upstream/zen.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/zenserver/upstream/zen.cpp b/zenserver/upstream/zen.cpp index cd6a531ca..b837f767c 100644 --- a/zenserver/upstream/zen.cpp +++ b/zenserver/upstream/zen.cpp @@ -377,23 +377,23 @@ ZenStructuredCacheClient::FreeSessionState(detail::ZenCacheSessionState* State) using namespace std::literals; -ZenStructuredCacheSession::ZenStructuredCacheSession(ZenStructuredCacheClient& OuterClient) -: m_Log(OuterClient.Log()) -, m_Client(OuterClient) +ZenStructuredCacheSession::ZenStructuredCacheSession(Ref<ZenStructuredCacheClient>&& OuterClient) +: m_Log(OuterClient->Log()) +, m_Client(std::move(OuterClient)) { - m_SessionState = m_Client.AllocSessionState(); + m_SessionState = m_Client->AllocSessionState(); } ZenStructuredCacheSession::~ZenStructuredCacheSession() { - m_Client.FreeSessionState(m_SessionState); + m_Client->FreeSessionState(m_SessionState); } ZenCacheResult ZenStructuredCacheSession::CheckHealth() { ExtendableStringBuilder<256> Uri; - Uri << m_Client.ServiceUrl() << "/health/check"; + Uri << m_Client->ServiceUrl() << "/health/check"; cpr::Session& Session = m_SessionState->GetSession(); Session.SetOption(cpr::Url{Uri.c_str()}); @@ -411,7 +411,7 @@ ZenCacheResult ZenStructuredCacheSession::GetCacheRecord(std::string_view Namespace, std::string_view BucketId, const IoHash& Key, ZenContentType Type) { ExtendableStringBuilder<256> Uri; - Uri << m_Client.ServiceUrl() << "/z$/"; + Uri << m_Client->ServiceUrl() << "/z$/"; if (Namespace != ZenCacheStore::DefaultNamespace) { Uri << Namespace << "/"; @@ -443,7 +443,7 @@ ZenStructuredCacheSession::GetCacheValue(std::string_view Namespace, const IoHash& ValueContentId) { ExtendableStringBuilder<256> Uri; - Uri << m_Client.ServiceUrl() << "/z$/"; + Uri << m_Client->ServiceUrl() << "/z$/"; if (Namespace != ZenCacheStore::DefaultNamespace) { Uri << Namespace << "/"; @@ -481,7 +481,7 @@ ZenStructuredCacheSession::PutCacheRecord(std::string_view Namespace, ZenContentType Type) { ExtendableStringBuilder<256> Uri; - Uri << m_Client.ServiceUrl() << "/z$/"; + Uri << m_Client->ServiceUrl() << "/z$/"; if (Namespace != ZenCacheStore::DefaultNamespace) { Uri << Namespace << "/"; @@ -517,7 +517,7 @@ ZenStructuredCacheSession::PutCacheValue(std::string_view Namespace, IoBuffer Payload) { ExtendableStringBuilder<256> Uri; - Uri << m_Client.ServiceUrl() << "/z$/"; + Uri << m_Client->ServiceUrl() << "/z$/"; if (Namespace != ZenCacheStore::DefaultNamespace) { Uri << Namespace << "/"; @@ -546,7 +546,7 @@ ZenCacheResult ZenStructuredCacheSession::InvokeRpc(const CbObjectView& Request) { ExtendableStringBuilder<256> Uri; - Uri << m_Client.ServiceUrl() << "/z$/$rpc"; + Uri << m_Client->ServiceUrl() << "/z$/$rpc"; BinaryWriter Body; Request.CopyTo(Body); @@ -579,7 +579,7 @@ ZenCacheResult ZenStructuredCacheSession::InvokeRpc(const CbPackage& Request) { ExtendableStringBuilder<256> Uri; - Uri << m_Client.ServiceUrl() << "/z$/$rpc"; + Uri << m_Client->ServiceUrl() << "/z$/$rpc"; SharedBuffer Message = FormatPackageMessageBuffer(Request).Flatten(); |