def __init__(self, resultfunc, downloadid, peerid, ip, port, rawserver,
                 encrypted = False):
        self.resultfunc = resultfunc
        self.downloadid = downloadid
        self.peerid = peerid
        self.ip = ip
        self.port = port
        self.encrypted = encrypted
        self.closed = False
        self.buffer = ''
        self.read = self._read
        self.write = self._write
        try:
            self.connection = rawserver.start_connection((ip, port), self)
            if encrypted:
                self._dc = not(CRYPTO_OK and CHECK_PEER_ID_ENCRYPTED)
                self.encrypter = Crypto(True, disable_crypto = self._dc)
                self.write(self.encrypter.pubkey+self.encrypter.padding())
            else:
                self.encrypter = None
                self.write(chr(len(protocol_name)) + protocol_name +
                    (chr(0) * 8) + downloadid)
        except socketerror:
            self.answer(False)
        except __HOLE__:
            self.answer(False)
        self.next_len, self.next_func = 1+len(protocol_name), self.read_header
dataset/ETHPy150Open Cclleemm/FriendlyTorrent/src/tornado/BitTornado/BT1/NatCheck.py/NatCheck.__init__