diff --git a/lib/remote/jsonrpcconnection.cpp b/lib/remote/jsonrpcconnection.cpp index 62466160f..a40d6ea69 100644 --- a/lib/remote/jsonrpcconnection.cpp +++ b/lib/remote/jsonrpcconnection.cpp @@ -192,27 +192,8 @@ void JsonRpcConnection::MessageHandler(const String& jsonString) if (!message->Get("id", &vid)) return; - String id = vid; - - ApiCallbackInfo aci; - - { - boost::mutex::scoped_lock lock(m_ApiCallbacksMutex); - auto it = m_ApiCallbacks.find(id); - - if (it == m_ApiCallbacks.end()) - return; - - aci = it->second; - m_ApiCallbacks.erase(it); - } - - try { - aci.Callback(message); - } catch (const std::exception& ex) { - Log(LogWarning, "JsonRpcConnection") - << "Error while processing message for identity '" << m_Identity << "'\n" << DiagnosticInformation(ex); - } + Log(LogWarning, "JsonRpcConnection", + "We received a JSON-RPC response message. This should never happen because we're only ever sending notifications."); return; } @@ -306,11 +287,6 @@ Value SetLogPositionHandler(const MessageOrigin::Ptr& origin, const Dictionary:: return Empty; } -bool ApiCallbackInfo::IsExpired(void) const -{ - return Timestamp < Utility::GetTime() - 300; -} - void JsonRpcConnection::CheckLiveness(void) { if (m_Seen < Utility::GetTime() - 60 && (!m_Endpoint || !m_Endpoint->GetSyncing())) { @@ -318,18 +294,6 @@ void JsonRpcConnection::CheckLiveness(void) << "No messages for identity '" << m_Identity << "' have been received in the last 60 seconds."; Disconnect(); } - - { - boost::mutex::scoped_lock lock(m_ApiCallbacksMutex); - - for (auto it = m_ApiCallbacks.begin(), last = m_ApiCallbacks.end(); it != last; ) { - if (it->second.IsExpired()) { - it = m_ApiCallbacks.erase(it); - } else { - ++it; - } - } - } } void JsonRpcConnection::TimeoutTimerHandler(void) @@ -379,14 +343,3 @@ double JsonRpcConnection::GetWorkQueueRate(void) return rate / count; } -void JsonRpcConnection::RegisterCallback(const String& id, const boost::function& callback) -{ - ApiCallbackInfo aci; - aci.Timestamp = Utility::GetTime(); - aci.Callback = callback; - - { - boost::mutex::scoped_lock lock(m_ApiCallbacksMutex); - m_ApiCallbacks[id] = aci; - } -} diff --git a/lib/remote/jsonrpcconnection.hpp b/lib/remote/jsonrpcconnection.hpp index 7a40f5f15..e62799c1e 100644 --- a/lib/remote/jsonrpcconnection.hpp +++ b/lib/remote/jsonrpcconnection.hpp @@ -43,14 +43,6 @@ enum ClientType class MessageOrigin; -struct ApiCallbackInfo -{ - double Timestamp; - boost::function Callback; - - bool IsExpired(void) const; -}; - /** * An API client connection. * @@ -97,8 +89,6 @@ private: double m_NextHeartbeat; double m_HeartbeatTimeout; boost::mutex m_DataHandlerMutex; - std::map m_ApiCallbacks; - boost::mutex m_ApiCallbacksMutex; StreamReadContext m_Context; @@ -111,8 +101,6 @@ private: static void TimeoutTimerHandler(void); void CheckLiveness(void); - void RegisterCallback(const String& id, const boost::function& callback); - void CertificateRequestResponseHandler(const Dictionary::Ptr& message); };