예제 #1
0
파일: __init__.py 프로젝트: juce/fiveserver
 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)
예제 #2
0
 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)
예제 #3
0
 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
예제 #4
0
 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
예제 #5
0
 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)