Beispiel #1
0
int Test_server::load_config()
{
    pre_log("start to load test server config file\n");

    // 打开配置文件
    Inifile inifile;

    if (inifile.open(get_config_file()) == false)
    {
        printf("load %s inifile failed\n", get_config_file());
        return 1;
    }

    m_module1 = new Module1;
//    m_module2 = new Module2;

    m_module1->set_name("module1");
//    m_module2->set_name("module2");

    //读取global配置信息
    char buffer[100];
    inifile.get_value("global", "log_dir", buffer, sizeof(buffer));
    pre_log("read global config, log_dir %s\n", buffer);

    m_module1->init_log("module1", buffer, "debug");
//    m_module2->init_log("module2", buffer, "debug");

    return 0;
}
Beispiel #2
0
int RakNet_core_server::load_config()
{
    pre_log("start to load test server config file\n");

    // 打开配置文件
    Inifile inifile;

    if (inifile.open(get_config_file()) == false)
    {
        printf("load %s inifile failed\n", get_config_file());
        return 1;
    }

    m_network_module = new Network_module;

    //读取global配置信息
    char buffer[100];
    inifile.get_value("global", "log_dir", buffer, sizeof(buffer));
    pre_log("read global config, log_dir %s\n", buffer);

    m_network_module->init_log("network_module", buffer, "debug");

    inifile.get_value("network_module", "max_connection", buffer, sizeof(buffer));
    m_network_module->set_max_connection(buffer);

    inifile.get_value("network_module", "max_income_connection", buffer, sizeof(buffer));
    m_network_module->set_max_income_connection(buffer);

    inifile.get_value("network_module", "local_port", buffer, sizeof(buffer));
    m_network_module->set_local_port(buffer);

    return 0;
}