Class CommSystemFacadeImpl

    • Constructor Detail

      • CommSystemFacadeImpl

        public CommSystemFacadeImpl​(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.
      • shutdown

        public void shutdown()
        Cannot be restarted after calling this. Use restart() for that.
      • restart

        public void restart()
        Description copied from interface: Service
        Perform a soft restart.
      • countActivePeers

        public int countActivePeers()
        How many peers are we currently connected to, that we have sent a message to or received a message from in the last five minutes.
        Specified by:
        countActivePeers in class CommSystemFacade
      • countActiveSendPeers

        public int countActiveSendPeers()
        How many peers are we currently connected to, that we have sent a message to in the last minute. Unused for anything, to be removed.
        Specified by:
        countActiveSendPeers in class CommSystemFacade
      • getFramedAveragePeerClockSkew

        public long getFramedAveragePeerClockSkew​(int percentToInclude)
        Description copied from class: CommSystemFacade
        Return framed average clock skew of connected peers in seconds, or null if we cannot answer. CommSystemFacadeImpl overrides this.
        Overrides:
        getFramedAveragePeerClockSkew in class CommSystemFacade
        Parameters:
        percentToInclude - 1-100
        Returns:
        Framed average clock skew of connected peers in milliseconds, or the clock offset if we cannot answer. Average is calculated over the middle "percentToInclude" peers. A positive number means our clock is ahead of theirs. Todo: change List to milliseconds
      • getEstablished

        public Set<Hash> getEstablished()
        Description copied from class: CommSystemFacade
        Get all the peers we are connected to. This should be more efficient than repeated calls to isEstablished() if you have to check a lot.
        Specified by:
        getEstablished in class CommSystemFacade
        Returns:
        a new set, may be modified
        Since:
        0.9.34
      • mayDisconnect

        public void mayDisconnect​(Hash peer)
        Tell the comm system that we may disconnect from this peer. This is advisory only.
        Overrides:
        mayDisconnect in class CommSystemFacade
        Since:
        0.9.24
      • forceDisconnect

        public void forceDisconnect​(Hash peer)
        Tell the comm system to disconnect from this peer.
        Overrides:
        forceDisconnect in class CommSystemFacade
        Since:
        0.9.38
      • renderStatusHTML

        public void renderStatusHTML​(Writer out,
                                     String urlBase,
                                     int sortFlags)
                              throws IOException
        As of 0.9.31, only outputs UPnP status Warning - blocking, very slow, queries the active UPnP router, will take many seconds if it has vanished.
        Overrides:
        renderStatusHTML in class CommSystemFacade
        Throws:
        IOException
      • notifyReplaceAddress

        public void notifyReplaceAddress​(RouterAddress udpAddr)
        UDP changed addresses, tell NTCP and restart All the work moved to NTCPTransport.externalAddressReceived()
        Overrides:
        notifyReplaceAddress in class CommSystemFacade
        Parameters:
        udpAddr - may be null; or udpAddr's host/IP may be null
      • notifyRemoveAddress

        public void notifyRemoveAddress​(RouterAddress address)
        Tell other transports our address changed
        Overrides:
        notifyRemoveAddress in class CommSystemFacade
        Parameters:
        address - may be null; or address's host/IP may be null
        Since:
        0.9.20
      • notifyRemoveAddress

        public void notifyRemoveAddress​(boolean ipv6)
        Tell other transports our address changed
        Overrides:
        notifyRemoveAddress in class CommSystemFacade
        Since:
        0.9.20
      • registerTransport

        public void registerTransport​(Transport t)
        Pluggable transports. Not for NTCP or SSU. Do not call from transport constructor. Transport must be ready to be started. Following transport methods will be called: setListener() externalAddressReceived() (zero or more times, one for each known address) startListening();
        Overrides:
        registerTransport in class CommSystemFacade
        Since:
        0.9.16
      • unregisterTransport

        public void unregisterTransport​(Transport t)
        Pluggable transports. Not for NTCP or SSU. Following transport methods will be called: setListener(null) stoptListening();
        Overrides:
        unregisterTransport in class CommSystemFacade
        Since:
        0.9.16
      • initGeoIP

        public void initGeoIP()
        Router must call after netdb is initialized
        Overrides:
        initGeoIP in class CommSystemFacade
        Since:
        0.9.41
      • queueLookup

        public void queueLookup​(byte[] ip)
        Overrides:
        queueLookup in class CommSystemFacade
        Parameters:
        ip - ipv4 or ipv6
      • isInStrictCountry

        public boolean isInStrictCountry​(Hash peer)
        Are they in a strict country. Not recommended for our local router hash, as we may not be either in the cache or netdb, or may not be publishing an IP.
        Overrides:
        isInStrictCountry in class CommSystemFacade
        Parameters:
        peer - non-null
        Since:
        0.9.16
      • getCountry

        public String getCountry​(Hash peer)
        Uses the transport IP first because that lookup is fast, then the IP from the netDb. Not recommended for our local router hash, as we may not be either in the cache or netdb, or may not be publishing an IP. As of 0.9.32, works only for literal IPs, returns null for hostnames.
        Overrides:
        getCountry in class CommSystemFacade
        Parameters:
        peer - not ourselves - use getOurCountry() for that
        Returns:
        two-letter lower-case country code or null
      • isDummy

        public boolean isDummy()
        Is everything disabled for testing?
        Overrides:
        isDummy in class CommSystemFacade
        Since:
        0.8.13