Bugfixes.

This commit is contained in:
Gunnar Beutner 2012-06-22 13:40:09 +02:00
parent 69d3e71b03
commit cae84e9827
5 changed files with 7 additions and 10 deletions

View File

@ -296,7 +296,7 @@ void Application::Log(LogSeverity severity, const string& facility, const string
char timestamp[100]; char timestamp[100];
// TODO: make this configurable // TODO: make this configurable
if (severity < LogInformation) if (!IsDebugging() && severity < LogInformation)
return; return;
string severityStr; string severityStr;

View File

@ -72,7 +72,7 @@ void DelegationComponent::AssignService(const Endpoint::Ptr& checker, const Serv
void DelegationComponent::AssignServiceResponseHandler(Service& service, const Endpoint::Ptr& sender, bool timedOut) void DelegationComponent::AssignServiceResponseHandler(Service& service, const Endpoint::Ptr& sender, bool timedOut)
{ {
/* ignore the message if it's not from the designated checker for this service */ /* ignore the message if it's not from the designated checker for this service */
if (!sender || service.GetChecker() != sender->GetIdentity()) if (sender && service.GetChecker() != sender->GetIdentity())
return; return;
if (timedOut) { if (timedOut) {

View File

@ -227,6 +227,11 @@ void EndpointManager::SendAnycastMessage(Endpoint::Ptr sender,
for (map<string, Endpoint::Ptr>::iterator i = m_Endpoints.begin(); i != m_Endpoints.end(); i++) for (map<string, Endpoint::Ptr>::iterator i = m_Endpoints.begin(); i != m_Endpoints.end(); i++)
{ {
Endpoint::Ptr endpoint = i->second; Endpoint::Ptr endpoint = i->second;
/* don't forward messages between non-local endpoints */
if (!sender->IsLocal() && !endpoint->IsLocal())
continue;
if (endpoint->HasSubscription(method)) if (endpoint->HasSubscription(method))
candidates.push_back(endpoint); candidates.push_back(endpoint);
} }

View File

@ -69,11 +69,6 @@ bool JsonRpcEndpoint::IsConnected(void) const
void JsonRpcEndpoint::ProcessRequest(Endpoint::Ptr sender, const RequestMessage& message) void JsonRpcEndpoint::ProcessRequest(Endpoint::Ptr sender, const RequestMessage& message)
{ {
if (IsConnected()) { if (IsConnected()) {
string id;
if (message.GetID(&id))
// TODO: remove calls after a certain timeout (and notify callers?)
m_PendingCalls[id] = sender;
m_Client->SendMessage(message); m_Client->SendMessage(message);
} else { } else {
// TODO: persist the event // TODO: persist the event
@ -116,8 +111,6 @@ void JsonRpcEndpoint::ClientClosedHandler(void)
{ {
Application::Log(LogWarning, "jsonrpc", "Lost connection to endpoint: identity=" + GetIdentity()); Application::Log(LogWarning, "jsonrpc", "Lost connection to endpoint: identity=" + GetIdentity());
m_PendingCalls.clear();
// TODO: _only_ clear non-persistent publications/subscriptions // TODO: _only_ clear non-persistent publications/subscriptions
// unregister ourselves if no persistent publications/subscriptions are left (use a timer for that, once we have a TTL property for the topics) // unregister ourselves if no persistent publications/subscriptions are left (use a timer for that, once we have a TTL property for the topics)
ClearSubscriptions(); ClearSubscriptions();

View File

@ -58,7 +58,6 @@ private:
shared_ptr<SSL_CTX> m_SSLContext; shared_ptr<SSL_CTX> m_SSLContext;
string m_Address; string m_Address;
JsonRpcClient::Ptr m_Client; JsonRpcClient::Ptr m_Client;
map<string, Endpoint::Ptr> m_PendingCalls;
void SetAddress(string address); void SetAddress(string address);