Пример #1
0
 public override void execute(TorInstance torInstance, TaskResultHandler callback)
 {
     base.execute(torInstance, callback);
     // doesn't seem like the appropriate level to be spawning tasks... for instance, how to interface db?
     // spwans a DnsTask to resolve the CNAME that tells us where to connect to perform the whois.
     new DnsTask(new DnsTransaction.QuestionRecord(string.Format("{0}.whois-servers.net", getTLD()), DnsTransaction.QTYPE.CNAME, DnsTransaction.RCLASS.IN)).execute(torInstance, callback);
 }
Пример #2
0
        //<summary> Takes a task from the queue and has a TorInstance handle it.
        //</summary>
        public void doWork()
        {
            if (taskList.Count > 0)
            {
                System.Console.WriteLine("Going to dequeue a task.");
                Task task = taskList.Dequeue();
                if (task is TorTask)
                {
                    TorTask                torTask = (TorTask)task;
                    TorInstance            torInstance = getAvailableTorInstance();
                    Task.TaskResultHandler a, b, c;
                    a = displayResults;
                    if (torTask.getOwner() != null)
                    {
                        Console.WriteLine("Adding Managed Task");
                        a = torTask.getOwner().notify;
                    }
                    b = db.cache;
                    c = a + b;
                    torTask.execute(torInstance, c);
                }
            }
            else
            {
//                Console.WriteLine("No work to be done.");
                Thread.Sleep(50);
            }
        }
Пример #3
0
 public override void execute(TorInstance torInstance, TaskResultHandler callback)
 {
     base.execute(torInstance, callback);
     // doesn't seem like the appropriate level to be spawning tasks... for instance, how to interface db?
     // spwans a DnsTask to resolve the CNAME that tells us where to connect to perform the whois.
     new DnsTask(new DnsTransaction.QuestionRecord(string.Format("{0}.whois-servers.net", getTLD()), DnsTransaction.QTYPE.CNAME, DnsTransaction.RCLASS.IN)).execute(torInstance, callback);
 }
Пример #4
0
        public override void execute(TorInstance torInstance, TaskResultHandler callback)
        {
            base.execute(torInstance, callback);

            // TODO: Look up proper nameserver to use, from cache (or by resolving NS)

            endPoint = new DnsEndPoint("8.8.8.8", 53);
            torInstance.proxy.CreateConnectionAsyncCompleted += new EventHandler <CreateConnectionAsyncCompletedEventArgs>(onConnect);
            torInstance.proxy.CreateConnectionAsync(endPoint.Host, endPoint.Port);
        }
Пример #5
0
        public virtual void execute(TorInstance _tor, TaskResultHandler callback)
        {
            base.execute(callback);
            tor = _tor;
            while (tor == null)
            {
                Thread.Sleep(SLEEP_TIME);
            }

            tor.State = TorInstance.TorState.Busy;
            while (tor.State != TorInstance.TorState.Busy)
            {
                Thread.Sleep(SLEEP_TIME);
            }
        }
Пример #6
0
        public virtual void execute(TorInstance _tor, TaskResultHandler callback)
        {
            base.execute(callback);
            tor = _tor;
            while(tor == null)
                Thread.Sleep(SLEEP_TIME);

            tor.State = TorInstance.TorState.Busy;
            while (tor.State != TorInstance.TorState.Busy)
                Thread.Sleep(SLEEP_TIME);
        }