void Shutdown(void);
- void Log(const char *format, ...);
+ static void Log(const char *format, ...);
ConfigHive::Ptr GetConfigHive(void) const;
void EndpointManager::AddListener(unsigned short port)
{
+ Application::Log("Adding new listener: port %d", port);
+
JsonRpcServer::Ptr server = make_shared<JsonRpcServer>(m_SSLContext);
RegisterServer(server);
void EndpointManager::AddConnection(string host, unsigned short port)
{
+ Application::Log("Adding new endpoint: %s:%d", host.c_str(), port);
+
JsonRpcEndpoint::Ptr endpoint = make_shared<JsonRpcEndpoint>();
endpoint->Connect(host, port, m_SSLContext);
RegisterEndpoint(endpoint);
int EndpointManager::NewClientHandler(const NewClientEventArgs& ncea)
{
+ Application::Log("Accepted new client");
+
JsonRpcEndpoint::Ptr endpoint = make_shared<JsonRpcEndpoint>();
endpoint->SetClient(static_pointer_cast<JsonRpcClient>(ncea.Client));
RegisterEndpoint(endpoint);
port = (unsigned short)portValue;
- Log("Creating JSON-RPC listener on port %d", port);
-
GetEndpointManager()->AddListener(port);
return 0;
port = (unsigned short)portValue;
- Log("Creating JSON-RPC connection to %s:%d", hostname.c_str(), port);
-
GetEndpointManager()->AddConnection(hostname, port);
return 0;
int JsonRpcEndpoint::ClientClosedHandler(const EventArgs& ea)
{
+ string address = GetAddress();
+ Application::Log("Lost connection to endpoint: %s", address.c_str());
+
m_PendingCalls.clear();
if (m_Client->GetPeerHost() != string()) {
timer->OnTimerExpired += bind_weak(&JsonRpcEndpoint::ClientReconnectHandler, shared_from_this());
timer->Start();
m_ReconnectTimer = timer;
+
+ Application::Log("Spawned reconnect timer (30 seconds)", address.c_str());
}
// TODO: _only_ clear non-persistent method sources/sinks