예제 #1
0
파일: ffgate.cpp 프로젝트: liangzhimy/FFRPC
int ffgate_t::open(arg_helper_t& arg_helper)
{
    LOGTRACE((FFGATE, "ffgate_t::open begin broker<%s>", arg_helper.get_option_value("-broker")));
    if (false == arg_helper.is_enable_option("-gate"))
    {
        LOGERROR((FFGATE, "ffgate_t::open failed without -gate argmuent"));
        return -1;
    }
    m_gate_name = arg_helper.get_option_value("-gate");
    m_ffrpc = new ffrpc_t(m_gate_name);
    
    m_ffrpc->reg(&ffgate_t::change_session_logic, this);
    m_ffrpc->reg(&ffgate_t::close_session, this);
    m_ffrpc->reg(&ffgate_t::route_msg_to_session, this);
    m_ffrpc->reg(&ffgate_t::broadcast_msg_to_session, this);
    
    if (m_ffrpc->open(arg_helper.get_option_value("-broker")))
    {
        LOGERROR((FFGATE, "ffgate_t::open failed check -broker argmuent"));
        return -1;
    }
    
    if (NULL == net_factory_t::gateway_listen(string("-gate_listen ") + arg_helper.get_option_value("-gate_listen"), this))
    {
        LOGERROR((FFGATE, "ffgate_t::open failed without -gate_listen"));
        return -1;
    }
    
    LOGTRACE((FFGATE, "ffgate_t::open end ok"));
    return 0;
}
예제 #2
0
파일: net_stat.cpp 프로젝트: Crawping/FFRPC
int net_stat_t::start(arg_helper_t& arg_helper_)
{
    if (arg_helper_.is_enable_option("-max_packet_size"))
    {
        m_max_packet_size = ::atoi(arg_helper_.get_option_value("-max_packet_size").c_str());
    }
    
    m_heartbeat.set_option(arg_helper_, timer_close);
    
    m_timer_service = new timer_service_t();
    
    m_timer_service->timer_callback(m_heartbeat.timeout(), task_t(&timer_check, (void*)this));
    return 0;
}
예제 #3
0
int gateway_acceptor_t::open(arg_helper_t& arg_helper)
{
	m_net_stat.start(arg_helper);
    return acceptor_impl_t::open(arg_helper.get_option_value("-gate_listen"));
}