const char* Socket::ToString(char s[ENDPOINT_STRING_SIZE]) { Endpoint endpoint; if (!GetEndpoint(endpoint)) return ""; return endpoint.ToString(s); }
void KeyspaceConn::Init(KeyspaceDB* kdb_, KeyspaceServer* server_) { Log_Trace(); TCPConn<KEYSPACE_BUF_SIZE>::Init(); if (!running) Log_Trace("KeyspaceConn::Init(): running == false"); running = true; KeyspaceService::Init(kdb_); server = server_; closeAfterSend = false; bytesRead = 0; Endpoint endpoint; socket.GetEndpoint(endpoint); endpoint.ToString(endpointString); Log_Message("[%s] Keyspace: client connected", endpointString); }
void ConfigServerApp::Init() { int sdbpPort; Endpoint httpEndpoint; ReadBuffer docroot; ReadBuffer prefix; ReadBuffer index; httpHandler.SetConfigServer(&configServer); httpServer.Init(configFile.GetIntValue("http.port", 8080)); httpServer.RegisterHandler(&httpHandler); docroot.Wrap(configFile.GetValue("http.documentRoot", ".")); prefix.Wrap(configFile.GetValue("http.staticPrefix", "/webadmin")); index.Wrap(configFile.GetValue("http.directoryIndex", "index.html")); httpFileHandler.Init(docroot, prefix); httpFileHandler.SetDirectoryIndex(index); httpServer.RegisterHandler(&httpFileHandler); sdbpPort = configFile.GetIntValue("sdbp.port", 7080); sdbpServer.Init(sdbpPort); sdbpServer.SetContext(&configServer); // start configServer only after network servers are started configServer.Init(); configServer.GetHTTPEndpoint(httpEndpoint); Log_Message("Web admin is started at http://%s%R", httpEndpoint.ToString(), &prefix); Log_Message("Waiting for connections on port %d", sdbpPort); statTimer.SetDelay(configFile.GetIntValue("controller.logStatTime", 0)); if (statTimer.GetDelay() != 0) { statTimer.SetCallable(MFUNC(ConfigServerApp, OnStatTimer)); EventLoop::Add(&statTimer); } }
void ConfigServerApp::Init() { int sdbpPort; Endpoint httpEndpoint; ReadBuffer docroot; ReadBuffer prefix; ReadBuffer index; httpHandler.SetConfigServer(&configServer); httpServer.Init(configFile.GetIntValue("http.port", 8080)); httpServer.RegisterHandler(&httpHandler); docroot.Wrap(configFile.GetValue("http.documentRoot", ".")); prefix.Wrap(configFile.GetValue("http.staticPrefix", "/webadmin")); index.Wrap(configFile.GetValue("http.directoryIndex", "index.html")); httpFileHandler.Init(docroot, prefix); httpFileHandler.SetDirectoryIndex(index); httpServer.RegisterHandler(&httpFileHandler); sdbpPort = configFile.GetIntValue("sdbp.port", 7080); sdbpServer.Init(sdbpPort); sdbpServer.SetContext(&configServer); sdbpServer.UseKeepAlive(false); // start configServer only after network servers are started configServer.Init(this); configServer.GetHTTPEndpoint(httpEndpoint); Log_Message("Web admin is started at http://%s%R", httpEndpoint.ToString(), &prefix); Log_Message("Waiting for connections on port %d", sdbpPort); logStatTimer.SetCallable(MFUNC(ConfigServerApp, OnLogStatTimer)); // logStatTime is in seconds in the config file, default is 10min SetLogStatTimeout(configFile.GetIntValue("controller.logStatTime", 600) * 1000); }