def connectCS(self): p = RPCClient(config.cs_host) if p is not None: res = yield p.call('registersrv', 'gs') if not res[0]: logger.info('registedCS: result:{0}'.format(res)) g_protoMgr.set_server('cs', p)
async def connectCS(self): host, port = self.get_host('CHARACTER') p = await connect(host, port, self.connectCS) if not p: log.warn('connect cs failed!') return res = await p.call('registersrv', 'gs') log.info('character is connected : {0}:{1}'.format(host, port)) if not res[0]: g_protoMgr.set_server('cs', p)
async def connectGW(self): host, port = self.get_host('GATEWAY') p = await connect(host, port, self.connectGW) if not p: log.warn('connect gw failed!') return res = await p.call('registersrv', 'gs') log.info('gateway is connected : {0}:{1}'.format(host, port)) if not res[0]: g_protoMgr.set_server('gw', p)
def registersrv(p, req): server = req p.setTimeout(None) g_protoMgr.set_server(server, p) return 0, 0
def registersrv(p, req): server, = req g_protoMgr.set_server(server, p) return 0, 0