Пример #1
0
//! 验证sessionid
int ffgate_t::verify_session_id(const message_t& msg_, socket_ptr_t sock_)
{
    string ip = socket_op_t::getpeername(sock_->socket());
    LOGTRACE((FFGATE, "ffgate_t::verify_session_id session_key[%s], ip[%s]", msg_.get_body(), ip));
    if (ip.empty())
    {
        sock_->close();
        return -1;
    }
    session_data_t* session_data = new session_data_t();
    sock_->set_data(session_data);
    //! 还未通过验证
    m_wait_verify_set.insert(sock_);

    session_verify_t::in_t msg;
    msg.session_key = msg_.get_body();
    msg.online_time = session_data->online_time;
    msg.gate_name   = m_gate_name;
    msg.ip          = ip;
    m_ffrpc->call(DEFAULT_LOGIC_SERVICE, msg, ffrpc_ops_t::gen_callback(&ffgate_t::verify_session_callback, this, sock_));
    LOGTRACE((FFGATE, "ffgate_t::verify_session_id end ok"));
    return 0;
}
Пример #2
0
//! 验证sessionid
int ffgate_t::verify_session_id(const message_t& msg_, socket_ptr_t sock_)
{
    string ip = socket_op_t::getpeername(sock_->socket());
    LOGTRACE((FFGATE, "ffgate_t::verify_session_id session_key len=%u, ip[%s]", msg_.get_body().size(), ip));
    if (ip.empty())
    {
        sock_->close();
        return -1;
    }
    session_data_t* session_data = new session_data_t(this->alloc_id());
    sock_->set_data(session_data);
    m_wait_verify_set[session_data->socket_id].sock = sock_;
    
    session_first_entere_t::in_t msg;
    msg.cmd         = msg_.get_cmd();
    msg.socket_id   = session_data->socket_id;
    msg.msg_body    = msg_.get_body();
    msg.gate_name   = m_gate_name;
    msg.ip          = ip;
    m_ffrpc->call(DEFAULT_LOGIC_SERVICE, msg, ffrpc_ops_t::gen_callback(&ffgate_t::verify_session_callback, this, session_data->socket_id));
    LOGTRACE((FFGATE, "ffgate_t::verify_session_id end ok"));
    return 0;
}