def requestServerInfo(self): if self.isGateRouteConnect(): GateRouteServerConnInfoReq = helper.createProto(900001) self.send( msgUtils.packMonitorMsg(900001, GateRouteServerConnInfoReq)) else: GetGameServerInfoReq = helper.createProto(900013) self.send(msgUtils.packMonitorMsg(900013, GetGameServerInfoReq))
def sendGetLogInfoMsg(self, serverId, serverType, subType, siteId): GetServerErrorLogReq = helper.createProto(900018) GetServerErrorLogReq.serverId = serverId GetServerErrorLogReq.serverType = serverType GetServerErrorLogReq.subType = subType GetServerErrorLogReq.siteId = siteId self.send(msgUtils.packMonitorMsg(900018, GetServerErrorLogReq))
def onGetMonitorServerInfo(self, data): GetMonitorServerInfoRes = helper.createProto(900016) GetMonitorServerInfoRes.connectedServerNum = self.server.getConnectedServerNum( ) GetMonitorServerInfoRes.registeredServerNum = self.server.getRegistedServerNum( ) GetMonitorServerInfoRes.monitorVersion = monitorVersion.version for connect in self.server.getAllGateRouteConnects(): gateRouteInfo = GetMonitorServerInfoRes.gateRouteServerInfo.add() connect.setServerInfoProto(gateRouteInfo.serverInfo) gateRouteInfo.connInfos.playerLinkCount = connect.connectedServersInfo.playerLinkCount gateRouteInfo.connInfos.playerCount = connect.connectedServersInfo.playerCount gateRouteInfo.connInfos.serverLinkCount = connect.connectedServersInfo.serverLinkCount gateRouteInfo.connInfos.serverCount = connect.connectedServersInfo.serverCount for serverInfo in connect.connectedServersInfo.serverInfo: connInfo = gateRouteInfo.connInfos.serverInfo.add() connInfo.id = serverInfo.id connInfo.state = serverInfo.state connInfo.type = serverInfo.type connInfo.subType = serverInfo.subType connInfo.url = serverInfo.url connInfo.siteId = serverInfo.siteId for connect in self.server.getAllNormalConnects(): normalServerInfo = GetMonitorServerInfoRes.normalServerInfo.add() connect.setServerInfoProto(normalServerInfo.serverInfo) normalServerInfo.gameServerstate = connect.gameServerstate normalServerInfo.dataBaseState = connect.dataBaseState self.send(msgUtils.packMonitorMsg(900016, GetMonitorServerInfoRes))
def notifyNewServer(self, conn): for connect in self.connects.values(): if connect != conn: RegisterServerReq = helper.createProto(900003) conn.setServerInfoProto(RegisterServerReq) connect.send(msgUtils.packMonitorMsg(900003, RegisterServerReq))
def notifyServerList(self, conn): RegiterServerNotify = helper.createProto(900004) for connect in self.connects.values(): if connect.registed: infoProto = RegiterServerNotify.serverInfo.add() connect.setServerInfoProto(infoProto) RegiterServerNotify.id = conn.id conn.send(msgUtils.packMonitorMsg(900004, RegiterServerNotify))
def onGetServerLog(self, data): print('onGetServerLog') GetServerErrorLogRes = helper.createProto(900019) connectList = [] if (data.serverId != 0): coonect = self.server.getConnectByServerId(data.serverId) connectList.append(coonect) elif data.serverType == -1: connectList = self.server.getConnectsByServerType( data.serverType, data.subType, data.siteId) else: connectList = self.server.getConnectsByServerType( data.serverType, data.subType, data.siteId) for connect in connectList: for log in connect.logs: GetServerErrorLogRes.logs.append(log) self.send(msgUtils.packMonitorMsg(900019, GetServerErrorLogRes))
def sendGetMonitorInfoMsg(self): GetMonitorServerInfoReq = helper.createProto(900015) self.send(msgUtils.packMonitorMsg(900015, GetMonitorServerInfoReq))
def onRegisterMonitor(self): GateRouteServerConnInfoReq = helper.createProto(900001) self.send(msgUtils.packMonitorMsg(900001, GateRouteServerConnInfoReq))