Exemplo n.º 1
0
 public static void CancelClientSearch(KadClientSearcher rFromRequester)
 {
     if (m_pInstance == null || GetUDPListener() == null)
     {
         Debug.Assert(false);
         return;
     }
     GetUDPListener().ExpireClientSearch(rFromRequester);
     SearchManager.CancelNodeSpecial(rFromRequester);
 }
Exemplo n.º 2
0
        public static bool FindIPByNodeID(KadClientSearcher rRequester, byte pachNodeID)
        {
            if (!IsRunning() || m_pInstance == null || GetUDPListener() == null)
            {
                Debug.Assert(false);
                return(false);
            }
            // first search our known contacts if we can deliver a result without asking, otherwise forward the request
            Contact pContact;

            if ((pContact = GetRoutingZone().GetContact(new UInt128(pachNodeID))) != null)
            {
                // make sure that this entry is not too old, otherwise just do a search to be sure
                if (pContact.GetLastSeen() != DateTime.MinValue && ((DateTime.Now - pContact.GetLastSeen()).Milliseconds < 1800))
                {
                    rRequester.KadSearchIPByNodeIDResult(EKadClientSearchRes.KCSR_SUCCEEDED, ntohl(pContact.IPAddress), pContact.TCPPort);
                    return(true);
                }
            }
            return(SearchManager.FindNodeSpecial(new UInt128(pachNodeID), rRequester));
        }
Exemplo n.º 3
0
        public static bool FindNodeIDByIP(KadClientSearcher rRequester, uint dwIP, ushort nTCPPort, ushort nUDPPort)
        {
            if (!IsRunning() || m_pInstance == null || GetUDPListener() == null || GetRoutingZone() == null)
            {
                Debug.Assert(false);
                return(false);
            }
            // first search our known contacts if we can deliver a result without asking, otherwise forward the request
            Contact pContact;

            if ((pContact = GetRoutingZone().GetContact(ntohl(dwIP), nTCPPort, true)) != null)
            {
                byte[] uchID = new byte[16];
                pContact.ClientID.ToByteArray(uchID);
                rRequester.KadSearchNodeIDByIPResult(EKadClientSearchRes.KCSR_SUCCEEDED, uchID);
                return(true);
            }
            else
            {
                return(GetUDPListener().FindNodeIDByIP(rRequester, ntohl(dwIP), nTCPPort, nUDPPort));
            }
        }
Exemplo n.º 4
0
 public void CancelClientSearch(KadClientSearcher rFromRequester)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 5
0
 public bool FindIPByNodeID(KadClientSearcher rRequester, byte[] pachNodeID)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 6
0
 public bool FindNodeIDByIP(KadClientSearcher rRequester,
                            uint dwIP, ushort nTCPPort, ushort nUDPPort)
 {
     throw new NotImplementedException();
 }