public void AnnouncePeerEncode() { Node n = new MonoTorrent.Dht.Node(NodeId.Create(), null); n.Token = token; AnnouncePeer m = new AnnouncePeer(id, infohash, 6881, token); m.TransactionId = transactionId; Compare(m, "d1:ad2:id20:abcdefghij01234567899:info_hash20:mnopqrstuvwxyz1234564:porti6881e5:token8:aoeusnthe1:q13:announce_peer1:t2:aa1:y1:qe"); }
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)); }