Example #1
0
        public override void Execute()
        {
            GetPeersTask task = new GetPeersTask(engine, infoHash);

            task.Completed += GotPeers;
            task.Execute();
        }
Example #2
0
        private void GotPeers(object o, TaskCompleteEventArgs e)
        {
            e.Task.Completed -= GotPeers;
            GetPeersTask getpeers = (GetPeersTask)e.Task;

            foreach (Node n in getpeers.ClosestActiveNodes.Values)
            {
                if (n.Token == null)
                {
                    continue;
                }
                AnnouncePeer  query = new AnnouncePeer(engine.LocalId, infoHash, port, n.Token);
                SendQueryTask task  = new SendQueryTask(engine, query, n);
                task.Completed += SentAnnounce;
                task.Execute();
                activeAnnounces++;
            }

            if (activeAnnounces == 0)
            {
                RaiseComplete(new TaskCompleteEventArgs(this));
            }
        }
Example #3
0
 public override void Execute()
 {
     GetPeersTask task = new GetPeersTask(engine, infoHash);
     task.Completed += GotPeers;
     task.Execute();
 }