本文整理汇总了C++中HttpServer::Shutdown方法的典型用法代码示例。如果您正苦于以下问题:C++ HttpServer::Shutdown方法的具体用法?C++ HttpServer::Shutdown怎么用?C++ HttpServer::Shutdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpServer
的用法示例。
在下文中一共展示了HttpServer::Shutdown方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
// after io is initialized, drop root rights
user = Config::GetValue("daemon.user", NULL);
if (!ChangeUser(user))
STOP_FAIL(rprintf("Cannot setuid to %s", user), 1);
DatabaseConfig dbConfig;
dbConfig.dir = Config::GetValue("database.dir", DATABASE_CONFIG_DIR);
dbConfig.pageSize = Config::GetIntValue("database.pageSize", DATABASE_CONFIG_PAGE_SIZE);
dbConfig.cacheSize = Config::GetIntValue("database.cacheSize", DATABASE_CONFIG_CACHE_SIZE);
dbConfig.logBufferSize = Config::GetIntValue("database.logBufferSize", DATABASE_CONFIG_LOG_BUFFER_SIZE);
dbConfig.checkpointTimeout = Config::GetIntValue("database.checkpointTimeout", DATABASE_CONFIG_CHECKPOINT_TIMEOUT);
dbConfig.verbose = Config::GetBoolValue("database.verbose", DATABASE_CONFIG_VERBOSE);
dbConfig.directDB = Config::GetBoolValue("database.directDB", DATABASE_CONFIG_DIRECT_DB);
dbConfig.txnNoSync = Config::GetBoolValue("database.txnNoSync", DATABASE_CONFIG_TXN_NOSYNC);
dbConfig.txnWriteNoSync = Config::GetBoolValue("database.txnWriteNoSync", DATABASE_CONFIG_TXN_WRITE_NOSYNC);
if (Config::GetBoolValue("database.warmCache", true) && firstRun)
WarmCache((char*)dbConfig.dir, dbConfig.cacheSize);
if (firstRun)
Log_Message("Opening database...");
if (!database.Init(dbConfig))
STOP_FAIL("Cannot initialize database!", 1);
if (firstRun)
Log_Message("Database opened");
dbWriter.Init(1);
dbReader.Init(Config::GetIntValue("database.numReaders", 20));
if (!RCONF->Init())
STOP_FAIL("Cannot initialize paxos!", 1);
KeyspaceDB* kdb;
if (mode == replicated)
{
RLOG->Init(Config::GetBoolValue("paxos.useSoftClock", true));
kdb = new ReplicatedKeyspaceDB;
}
else
{
kdb = new SingleKeyspaceDB;
}
kdb->Init();
HttpServer protoHttp;
HttpKeyspaceHandler httpKeyspaceHandler(kdb);
int httpPort = Config::GetIntValue("http.port", 8080);
if (httpPort)
{
protoHttp.Init(httpPort);
protoHttp.RegisterHandler(&httpKeyspaceHandler);
}
KeyspaceServer protoKeyspace;
protoKeyspace.Init(kdb, Config::GetIntValue("keyspace.port", 7080));
EventLoop::Init();
EventLoop::Run();
EventLoop::Shutdown();
if (mode == replicated)
deleteDB = ((ReplicatedKeyspaceDB*)kdb)->DeleteDB();
else
deleteDB = false;
protoKeyspace.Shutdown();
protoHttp.Shutdown();
kdb->Shutdown();
delete kdb;
dbReader.Shutdown();
dbWriter.Shutdown();
RLOG->Shutdown();
database.Shutdown();
IOProcessor::Shutdown();
if (mode == replicated && deleteDB)
{
// snprintf(buf, SIZE(buf), "%s/__*", dbConfig.dir);
// DeleteWC(buf);
snprintf(buf, SIZE(buf), "%s/log*", dbConfig.dir);
DeleteWC(buf);
snprintf(buf, SIZE(buf), "%s/keyspace", dbConfig.dir);
DeleteWC(buf);
#ifdef _WIN32
MSleep(3000); // otherwise Windows won't let use reuse the same ports
#endif
firstRun = false;
goto run;
}
}
Log_Message("Keyspace shutting down.");
Config::Shutdown();
Log_Shutdown();
}