def _packetReceived(self, pkt): self.resetTimeout() try: if self.factory.serverConfig.Debug: try: username = self._user.profile.name except AttributeError: username = '' log.debug('[RECV {%s}]: %s' % (username, PacketFormatter.format(pkt))) # handle heartbeat packet here, since it's the same # across all types of servers if pkt.header.id == 0x0005: pkt.header.packet_count = self._count self.send(pkt) return # let subclasses handle it self.packetReceived(pkt) except: log.msg("Error in protocol._packetReceived: %s" % sys.exc_info()[0]) exc_type, exc_value, exc_traceback = sys.exc_info() lines = traceback.format_exception(exc_type, exc_value, exc_traceback) log.msg("Lines: %s" % lines) log.msg('[RECV {%s}]: %s' % (username, PacketFormatter.format(pkt)))
def _packetReceived(self, pkt): self.resetTimeout() try: if self.factory.serverConfig.Debug: try: username = self._user.profile.name except AttributeError: username = '' log.debug('[RECV {%s}]: %s' % ( username, PacketFormatter.format(pkt))) # handle heartbeat packet here, since it's the same # across all types of servers if pkt.header.id == 0x0005: pkt.header.packet_count = self._count self.send(pkt) return # let subclasses handle it self.packetReceived(pkt) except: log.msg("Error in protocol._packetReceived: %s" % sys.exc_info()[0]) exc_type, exc_value, exc_traceback = sys.exc_info() lines = traceback.format_exception(exc_type, exc_value, exc_traceback) log.msg("Lines: %s" % lines) log.msg('[RECV {%s}]: %s' % (username, PacketFormatter.format(pkt)))
def send(self, pkt): #log.msg('sending: %s' % repr(pkt)) if self.factory.serverConfig.Debug: try: username = self._user.profile.name except AttributeError: username = '' log.debug('[SEND {%s}]: %s' % ( username, PacketFormatter.format(pkt))) self.transport.write(stream.xorData(str(pkt),0)) self._count += 1
def send(self, pkt): #log.msg('sending: %s' % repr(pkt)) if self.factory.serverConfig.Debug: try: username = self._user.profile.name except AttributeError: username = '' log.debug('[SEND {%s}]: %s' % (username, PacketFormatter.format(pkt))) self.transport.write(stream.xorData(str(pkt), 0)) self._count += 1
def _packetReceived(self, pkt): if self.factory.serverConfig.Debug: try: username = self._user.profile.name except AttributeError: username = '' log.debug('[RECV {%s}]: %s' % (username, PacketFormatter.format(pkt))) # handle heartbeat packet here, since it's the same # across all types of servers if pkt.header.id == 0x0005: pkt.header.packet_count = self._count self.send(pkt) return # let subclasses handle it self.packetReceived(pkt)
def connectionMade(self): try: self.transport.setTcpKeepAlive(1) except: log.msg("Error in protocol.connectionMade: %s" % sys.exc_info()[0]) exc_type, exc_value, exc_traceback = sys.exc_info() lines = traceback.format_exception(exc_type, exc_value, exc_traceback) log.msg("Lines: %s" % lines) log.msg('[RECV {%s}]: %s' % (username, PacketFormatter.format(pkt))) try: PacketReceiver.connectionMade(self) self._handlers = dict() self.register() except: log.msg("Error in protocol.connectionMade: %s" % sys.exc_info()[0]) exc_type, exc_value, exc_traceback = sys.exc_info() lines = traceback.format_exception(exc_type, exc_value, exc_traceback) log.msg("Lines: %s" % lines)