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)
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"])
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"])