예제 #1
0
파일: remote_call.py 프로젝트: cnsoft/GGSvr
def remote_call(sub_svr_name, sub_svr_id, func, args, kwds):
    global call_data
    if not gnet.is_sub_server:
        call_id = _get_next_id()
        async_result = gevent.event.AsyncResult()
        call_data[call_id] = async_result 
                
        gnet.sends(sub_svr_name, sub_svr_id, [MSGID_REMOTE_CALL, call_id, func, args, kwds])
        # 等待返回
        is_seccess, return_data = async_result.get(True, REMOTE_CALL_TIMEOUT) 
        if is_seccess:
            glog.debug("remote_call>remote_call return:%s" % repr(return_data))
            return return_data
        else:
            glog.error("remote_call>remote_call return Exception:\n%s" % return_data)
예제 #2
0
def remote_call(sub_svr_name, sub_svr_id, func, args, kwds):
    global call_data
    if not gnet.is_sub_server:
        call_id = _get_next_id()
        async_result = gevent.event.AsyncResult()
        call_data[call_id] = async_result

        gnet.sends(sub_svr_name, sub_svr_id,
                   [MSGID_REMOTE_CALL, call_id, func, args, kwds])
        # 等待返回
        is_seccess, return_data = async_result.get(True, REMOTE_CALL_TIMEOUT)
        if is_seccess:
            glog.debug("remote_call>remote_call return:%s" % repr(return_data))
            return return_data
        else:
            glog.error("remote_call>remote_call return Exception:\n%s" %
                       return_data)
예제 #3
0
def on_test(data):
    print "on_test", data
    global player_conn_id

    conn_id = data[0]
    msg = data[1]

    player_conn_id = conn_id

    #time.sleep(1);
    #print "sleep 1"
    #time.sleep(1);
    #print "sleep 1"
    #time.sleep(1);
    #print "sleep 1"
    #gnet.send( conn_id, [msg] )
    gnet.sends(SVR_SUB_NAME, SVR_SUB_ID, [prt_test_game.TEST_SUB, "mian -> sub"])
예제 #4
0
def on_test(data):
    print "on_test", data
    global player_conn_id

    conn_id = data[0]
    msg = data[1]

    player_conn_id = conn_id

    time.sleep(1);
    print "sleep 1"
    time.sleep(1);
    print "sleep 1"
    time.sleep(1);
    print "sleep 1"
    #gnet.send( conn_id, [msg] )
    gnet.sends(SVR_SUB_NAME, SVR_SUB_ID, [prt_test_game.TEST_SUB, "mian -> sub"])