def dataReceived(self, data): self._recvd += data while len(self._recvd) >= 8: hdr = packet.makePacketHeader(stream.xorData(self._recvd[:8], 0)) if len(self._recvd) < hdr.length + 24: break pkt = packet.makePacket( stream.xorData(self._recvd[:hdr.length + 24], 8)) self._recvd = self._recvd[hdr.length + 24:] self._packetReceived(pkt)
def dataReceived(self, data): try: self.resetTimeout() self._recvd += data while len(self._recvd) >= 8: hdr = packet.makePacketHeader(stream.xorData(self._recvd[:8], 0)) if len(self._recvd) < hdr.length + 24: break pkt = packet.makePacket( stream.xorData(self._recvd[:hdr.length + 24], 8)) self._recvd = self._recvd[hdr.length + 24:] self._packetReceived(pkt) except: log.msg("ERROR in ___init___.py:PacketReceiver.dataReceived: %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)
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 dataReceived(self, data): try: self.resetTimeout() self._recvd += data while len(self._recvd) >= 8: hdr = packet.makePacketHeader( stream.xorData(self._recvd[:8], 0)) if len(self._recvd) < hdr.length + 24: break pkt = packet.makePacket( stream.xorData(self._recvd[:hdr.length + 24], 8)) self._recvd = self._recvd[hdr.length + 24:] self._packetReceived(pkt) except: log.msg("ERROR in ___init___.py:PacketReceiver.dataReceived: %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)