本文整理汇总了C++中NodeManager::init方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeManager::init方法的具体用法?C++ NodeManager::init怎么用?C++ NodeManager::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeManager
的用法示例。
在下文中一共展示了NodeManager::init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run_haggle
int run_haggle()
{
srand(time(NULL));
#ifdef ENABLE_DEBUG_MANAGER
DebugManager *db = NULL;
#endif
ApplicationManager *am = NULL;
DataManager *dm = NULL;
// SW: START: SendPriorityManager
SendPriorityManager *spm = NULL;
// SW: END: SendPriorityManager
NodeManager *nm = NULL;
ProtocolManager *pm = NULL;
ForwardingManager *fm = NULL;
SecurityManager *sm = NULL;
ConnectivityManager *cm = NULL;
LossEstimateManager *lm = NULL;
NetworkCodingManager* networkCodingManager = NULL;
FragmentationManager* fragmentationManager = NULL;
//JM
ReplicationManager *replicationManager = NULL;
BenchmarkManager *bm = NULL;
ResourceManager *rm = NULL;
// SW: START: interest manager
InterestManager *im = NULL;
// SW: END: interest manager
ProtocolSocket *p = NULL;
#ifdef OS_WINDOWS_MOBILE
// For testing we force the deletion of the data store
//recreateDataStore = true;
#endif
int retval = EXIT_FAILURE;
#if defined(OS_ANDROID)
//mallopt(-1, -1); // MOS - avoid trimming
#elif defined(OS_LINUX)
mallopt(M_TRIM_THRESHOLD, -1); // MOS - avoid trimming
#endif
xmlInitParser(); // MOS - this need to be called here for thread-safe libxml use
#ifdef DEBUG
Trace::trace.enableFileTrace();
#endif
HAGGLE_LOG("\n\n****************** HAGGLE STARTUP *********************\n\n");
if (!create_path(HAGGLE_DEFAULT_STORAGE_PATH)) {
HAGGLE_ERR("Could not create Haggle storage path : %s\n", HAGGLE_DEFAULT_STORAGE_PATH);
return -1;
}
retval = write_pid_file(getpid());
if (retval != HAGGLE_PROCESS_NO_ERROR) {
switch (retval) {
case HAGGLE_PROCESS_BAD_PID:
HAGGLE_ERR("Cannot read PID file %s.\n", PID_FILE.c_str());
break;
case HAGGLE_PROCESS_CANNOT_WRITE_PID:
HAGGLE_ERR("Cannot write PID file %s\n", PID_FILE.c_str());
break;
case HAGGLE_PROCESS_ALREADY_RUNNING:
HAGGLE_ERR("PID file %s indicates that Haggle is already running.\n", PID_FILE.c_str());
break;
default:
HAGGLE_ERR("Unknown PID file error\n");
}
shouldCleanupPidFile = false;
return -1;
}
#if defined(OS_UNIX) && !defined(OS_ANDROID)
setrawtty();
#endif
/* Seed the random number generator */
prng_init();
// SW: START CONFIG PATH (instead of hardcoded ~/.Haggle/config.xml),
if (useMemoryDB) {
kernel = new HaggleKernel(configFile, new MemoryDataStore(recreateDataStore));
}
else {
kernel = new HaggleKernel(configFile, new SQLDataStore(recreateDataStore));
}
// SW: END CONFIG PATH.
if (!kernel || !kernel->init()) {
fprintf(stderr, "Kernel initialization error!\n");
return -1;
}
// Build a Haggle configuration
am = new ApplicationManager(kernel);
if (!am || !am->init()) {
HAGGLE_ERR("Could not initialize application manager\n");
//.........这里部分代码省略.........
示例2: run_haggle
int run_haggle()
{
#ifdef ENABLE_DEBUG_MANAGER
DebugManager *db = NULL;
#endif
ApplicationManager *am = NULL;
DataManager *dm = NULL;
NodeManager *nm = NULL;
ProtocolManager *pm = NULL;
ForwardingManager *fm = NULL;
SecurityManager *sm = NULL;
ConnectivityManager *cm = NULL;
#ifdef BENCHMARK
BenchmarkManager *bm = NULL;
//recreateDataStore = true;
#endif
ResourceManager *rm = NULL;
ProtocolSocket *p = NULL;
#ifdef OS_WINDOWS_MOBILE
// For testing we force the deletion of the data store
//recreateDataStore = true;
#endif
int retval = EXIT_FAILURE;
if (!create_path(HAGGLE_DEFAULT_STORAGE_PATH)) {
HAGGLE_ERR("Could not create Haggle storage path : %s\n", HAGGLE_DEFAULT_STORAGE_PATH);
return -1;
}
retval = write_pid_file(getpid());
if (retval != HAGGLE_PROCESS_NO_ERROR) {
switch (retval) {
case HAGGLE_PROCESS_BAD_PID:
HAGGLE_ERR("Cannot read PID file %s.\n", PID_FILE.c_str());
break;
case HAGGLE_PROCESS_CANNOT_WRITE_PID:
HAGGLE_ERR("Cannot write PID file %s\n", PID_FILE.c_str());
break;
case HAGGLE_PROCESS_ALREADY_RUNNING:
HAGGLE_ERR("PID file %s indicates that Haggle is already running.\n", PID_FILE.c_str());
break;
default:
HAGGLE_ERR("Unknown PID file error\n");
}
shouldCleanupPidFile = false;
return -1;
}
#if defined(OS_UNIX) && !defined(OS_ANDROID)
setrawtty();
#endif
/* Seed the random number generator */
prng_init();
kernel = new HaggleKernel(new SQLDataStore(recreateDataStore));
if (!kernel || !kernel->init()) {
fprintf(stderr, "Kernel initialization error!\n");
return -1;
}
// Build a Haggle configuration
am = new ApplicationManager(kernel);
if (!am || !am->init()) {
HAGGLE_ERR("Could not initialize application manager\n");
goto finish;
}
dm = new DataManager(kernel, setCreateTimeOnBloomfilterUpdate);
if (!dm || !dm->init()) {
HAGGLE_ERR("Could not initialize data manager\n");
goto finish;
}
nm = new NodeManager(kernel);
if (!nm || !nm->init()) {
HAGGLE_ERR("Could not initialize node manager\n");
goto finish;
}
pm = new ProtocolManager(kernel);
if (!pm || !pm->init()) {
HAGGLE_ERR("Could not initialize protocol manager\n");
goto finish;
}
fm = new ForwardingManager(kernel);
if (!fm || !fm->init()) {
HAGGLE_ERR("Could not initialize forwarding manager\n");
goto finish;
}
//.........这里部分代码省略.........