Beispiel #1
0
        internal void SendGetPeersQuery(IPEndPoint address, byte[] infoHash)
        {
            var transactionID = DHTHelper.GetTransactionId();
            var msg           = DHTMessage.CreateGetPeersQuery(transactionID, fLocalID, infoHash);

            SetTransaction(transactionID, msg);
            Send(address, msg);
        }
Beispiel #2
0
        private void SendGetPeersQuery(IPEndPoint address, byte[] infoHash)
        {
            var transactionID = DHTHelper.GetTransactionId();

            byte[] nid = fLocalID;

            BDictionary sendData = DHTMessage.CreateGetPeersQuery(transactionID, nid, infoHash);

            SetTransaction(transactionID, new DHTMessage(MsgType.query, QueryType.get_peers, sendData));
            Send(address, sendData);
        }
Beispiel #3
0
        internal void SendGetPeersQuery(IPEndPoint address, DHTId infoHash)
        {
#if DEBUG_DHT_INTERNALS
            fLogger.WriteDebug("Send get peers query {0}", address);
#endif

            var transactionID = DHTTransactions.GetNextId();
            var msg           = DHTMessage.CreateGetPeersQuery(transactionID, fLocalID, infoHash);
            fTransactions.SetQuery(transactionID, msg);
            Send(address, msg);
        }
Beispiel #4
0
        public void Test_CreateGetPeersQuery()
        {
            var        tid      = DHTTransactions.GetNextId();
            var        nodeId   = DHTId.CreateRandom();
            var        infoHash = DHTId.CreateRandom();
            DHTMessage msg      = DHTMessage.CreateGetPeersQuery(tid, nodeId, infoHash);

            Assert.IsNotNull(msg);
            Assert.AreEqual(MessageType.Query, msg.Type);
            Assert.AreEqual(QueryType.GetPeers, msg.QueryType);
            // TODO: test contents
        }