Class FloodfillNetworkDatabaseFacade

    • Field Detail

      • MAX_TO_FLOOD

        public static final int MAX_TO_FLOOD
        This is the flood redundancy. Entries are sent to this many other floodfills. Was 7 through release 0.9; 5 for 0.9.1. 4 as of 0.9.2; 3 as of 0.9.9
        See Also:
        Constant Field Values
      • PUBLISH_TIMEOUT

        static final long PUBLISH_TIMEOUT
        This maybe could be shorter than RepublishLeaseSetJob.REPUBLISH_LEASESET_TIMEOUT, because we are sending direct, but unresponsive floodfills may take a while due to timeouts.
        See Also:
        Constant Field Values
      • MIN_ACTIVE_PEERS

        protected static final int MIN_ACTIVE_PEERS
        NTCP cons drop quickly but SSU takes a while, so it's prudent to keep this a little higher than 1 or 2.
        See Also:
        Constant Field Values
    • Constructor Detail

      • FloodfillNetworkDatabaseFacade

        public FloodfillNetworkDatabaseFacade​(RouterContext context)
    • Method Detail

      • startup

        public void startup()
        Description copied from interface: Service
        Instruct the service that it should start normal operation. This call DOES block until the service is ready.
        Specified by:
        startup in interface Service
        Overrides:
        startup in class KademliaNetworkDatabaseFacade
      • shouldThrottleFlood

        boolean shouldThrottleFlood​(Hash key)
        Increments and tests.
        Since:
        0.7.11
      • shouldThrottleLookup

        boolean shouldThrottleLookup​(Hash from,
                                     TunnelId id)
        Increments and tests.
        Since:
        0.7.11
      • floodConditional

        public boolean floodConditional​(DatabaseEntry ds)
        If we are floodfill AND the key is not throttled, flood it, otherwise don't.
        Returns:
        if we did
        Since:
        0.9.36 for NTCP2
      • flood

        public void flood​(DatabaseEntry ds)
        Send to a subset of all floodfill peers. We do this to implement Kademlia within the floodfills, i.e. we flood to those closest to the key.
      • setFloodfillEnabled

        public void setFloodfillEnabled​(boolean yes)
        Public, called from console. This wakes up the floodfill monitor, which will rebuild the RI and log in the event log, and call setFloodfillEnabledFromMonitor which really sets it.
      • setFloodfillEnabledFromMonitor

        void setFloodfillEnabledFromMonitor​(boolean yes)
        Package private, called from FloodfillMonitorJob. This does not wake up the floodfill monitor.
        Since:
        0.9.34
      • floodfillEnabled

        public boolean floodfillEnabled()
        Description copied from class: NetworkDatabaseFacade
        For convenience, so users don't have to cast to FNDF, and unit tests using Dummy NDF will work.
        Overrides:
        floodfillEnabled in class NetworkDatabaseFacade
        Returns:
        false; FNDF overrides to return actual setting
      • isFloodfill

        public static boolean isFloodfill​(RouterInfo peer)
        Parameters:
        peer - may be null, returns false if null
      • search

        SearchJob search​(Hash key,
                         Job onFindJob,
                         Job onFailedLookupJob,
                         long timeoutMs,
                         boolean isLease)
        Lookup using exploratory tunnels. Caller should check negative cache and/or banlist before calling. Begin a kademlia style search for the key specified, which can take up to timeoutMs and will fire the appropriate jobs on success or timeout (or if the kademlia search completes without any match)
        Overrides:
        search in class KademliaNetworkDatabaseFacade
        Returns:
        null always
      • search

        SearchJob search​(Hash key,
                         Job onFindJob,
                         Job onFailedLookupJob,
                         long timeoutMs,
                         boolean isLease,
                         Hash fromLocalDest)
        Lookup using the client's tunnels. Caller should check negative cache and/or banlist before calling.
        Overrides:
        search in class KademliaNetworkDatabaseFacade
        Parameters:
        fromLocalDest - use these tunnels for the lookup, or null for exploratory
        Returns:
        null always
        Since:
        0.9.10
      • complete

        void complete​(Hash key)
        Must be called by the search job queued by search() on success or failure
      • getFloodfillPeers

        public List<Hash> getFloodfillPeers()
        list of the Hashes of currently known floodfill peers; Returned list will not include our own hash. List is not sorted and not shuffled.
      • isVerifyInProgress

        boolean isVerifyInProgress​(Hash h)
        Since:
        0.7.10
      • verifyStarted

        void verifyStarted​(Hash h)
        Since:
        0.7.10
      • verifyFinished

        void verifyFinished​(Hash h)
        Since:
        0.7.10