def sendm(data): global is_sub_server glog.log("gnet>[sendm] %s" % str(data)) if not is_sub_server: glog.error("gnet>can NOT do sendm()") return trans_sub.send(_pack(data))
def init_sub_server(main_ip, main_port, sub_name, sub_id): global is_sub_server glog.log("server sub_server (%s : %d) at %s:%d" % (sub_name, sub_id, main_ip, main_port)) trans_sub.init((main_ip, main_port), on_connect, on_disconnect, on_data) import remote_call;remote_call.init() # 发送子服务器登录 trans_sub.send(_pack([MSGID_SUB_SERVER_LOGIN, sub_name, sub_id])) is_sub_server = True
def init_sub_server(main_ip, main_port, sub_name, sub_id): global is_sub_server glog.log("server sub_server (%s : %d) at %s:%d" % (sub_name, sub_id, main_ip, main_port)) trans_sub.init((main_ip, main_port), on_connect, on_disconnect, on_data) import remote_call remote_call.init() # 发送子服务器登录 trans_sub.send(_pack([MSGID_SUB_SERVER_LOGIN, sub_name, sub_id])) is_sub_server = True