cluster: Fix deadlock when reconnecting.

This commit is contained in:
Gunnar Beutner 2013-08-30 10:34:32 +02:00
parent 7f52e04a01
commit ecc583fba0

View File

@ -164,13 +164,7 @@ void ClusterComponent::ListenerThreadProc(const Socket::Ptr& server)
for (;;) { for (;;) {
Socket::Ptr client = server->Accept(); Socket::Ptr client = server->Accept();
try { Utility::QueueAsyncCallback(bind(&ClusterComponent::NewClientHandler, this, client, TlsRoleServer));
NewClientHandler(client, TlsRoleServer);
} catch (const std::exception& ex) {
std::stringstream message;
message << "Error for new JSON-RPC socket: " << boost::diagnostic_information(ex);
Log(LogInformation, "cluster", message.str());
}
} }
} }
@ -192,12 +186,8 @@ void ClusterComponent::AddConnection(const String& node, const String& service)
TcpSocket::Ptr client = boost::make_shared<TcpSocket>(); TcpSocket::Ptr client = boost::make_shared<TcpSocket>();
try { client->Connect(node, service);
client->Connect(node, service); Utility::QueueAsyncCallback(bind(&ClusterComponent::NewClientHandler, this, client, TlsRoleClient));
NewClientHandler(client, TlsRoleClient);
} catch (const std::exception& ex) {
Log(LogInformation, "cluster", "Could not connect to " + node + ":" + service + ": " + ex.what());
}
} }
/** /**