def dataReceived(self, data):
        """
        Called whenever data is received.

        @type data: C{str}
        @param data: Part or all of a SOCKSv4 packet.
        """
        if self.otherConn:
            self.otherConn.write(data)
            return
        self.buf = self.buf + data
        completeBuffer = self.buf
        if "\000" in self.buf[8:]:
            head, self.buf = self.buf[:8], self.buf[8:]
            version, code, port = struct.unpack("!BBH", head[:4])
            user, self.buf = self.buf.split("\000", 1)
            if head[4:7] == "\000\000\000" and head[7] != "\000":
                # An IP address of the form 0.0.0.X, where X is non-zero,
                # signifies that this is a SOCKSv4a packet.
                # If the complete packet hasn't been received, restore the
                # buffer and wait for it.
                if self.buf not in "\000":
                    self.buf = completeBuffer
                    return
                server, self.buf = self.buf.split("\000", 1)
                d = self.reactor.resolve(server)
                d.addCallback(self._dataReceived2, user,
                              version, code, port)
                d.addErrback(lambda result, self = self: self.makeReply(91))
                return
            else:
                server = socket.inet_ntoa(head[4:8])

            self._dataReceived2(server, user, version, code, port)
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/protocols/socks.py/SOCKSv4.dataReceived/swapped operands of `not in`