예제 #1
0
        private NodeContact Ping(IPEndPoint nodeEP)
        {
            DhtRpcPacket response = Query(DhtRpcPacket.CreatePingPacketQuery(_currentNode), new NodeContact(null, nodeEP));

            if (response == null)
            {
                return(null);
            }
            else
            {
                return(response.SourceNode);
            }
        }
예제 #2
0
        internal bool Ping(NodeContact contact)
        {
            DhtRpcPacket response = Query(DhtRpcPacket.CreatePingPacketQuery(_currentNode), contact);

            if (response == null)
            {
                return(false);
            }
            else
            {
                if (contact.Equals(response.SourceNode))
                {
                    return(true);
                }
                else
                {
                    contact.IncrementRpcFailCount();
                    return(false);
                }
            }
        }