def func(onion,cookie,client): onion += '.onion' while True: self.dbg('tc connect to '+onion+' cookie='+cookie) sock,err = util.tor_connect(onion,11009) if sock is not None: onion = onion.replace('.onion','') self.dbg('tc got outcon to '+onion) self.onions[onion] = out_handler(cookie,onion,sock,self,client) client.outcon = self.onions[onion] client.outcon.send_pong(cookie) client.outcon.send_status() break self.dbg('tc connect error='+err)
def tor_link(self,host,port=6660): self._link(lambda : util.tor_connect(host,int(port)),str(host))