Package freenet.io.AddressTracker

Examples of freenet.io.AddressTracker.Status


  public Status getConnectivityStatus() {
    long now = System.currentTimeMillis();
    if (now - lastConnectivityStatusUpdate < MINUTES.toMillis(3))
      return lastConnectivityStatus;

    Status value;
    if (crypto.config.alwaysHandshakeAggressively())
      value = AddressTracker.Status.DEFINITELY_NATED;
    else
      value = sock.getDetectedConnectivityStatus();
View Full Code Here


   * Return all the ports that we have reason to believe are not forwarded. E.g. for the user-alert, which only
   * shows if what we return is of nonzero length.
   */
  public int[] getUDPPortsNotForwarded() {
    OpennetManager om = node.getOpennet();
    Status darknetStatus = (node.peers.anyDarknetPeers() ? node.darknetCrypto.getDetectedConnectivityStatus() : AddressTracker.Status.DONT_KNOW);
    Status opennetStatus = om == null ? Status.DONT_KNOW : om.crypto.getDetectedConnectivityStatus();
    if(om == null || opennetStatus.ordinal() >= AddressTracker.Status.DONT_KNOW.ordinal()) {
      if(darknetStatus.ordinal() >= AddressTracker.Status.DONT_KNOW.ordinal()) {
        return new int[] { };
      } else {
        return new int[] { (darknetStatus.ordinal() < AddressTracker.Status.MAYBE_NATED.ordinal() ? -1 : 1) * node.getDarknetPortNumber() };
      }
    } else {
      if(darknetStatus.ordinal() >= AddressTracker.Status.DONT_KNOW.ordinal()) {
        return new int[] { (opennetStatus.ordinal() < AddressTracker.Status.MAYBE_NATED.ordinal() ? -1 : 1 ) * om.crypto.portNumber };
      } else {
        return new int[] { ((darknetStatus.ordinal() < AddressTracker.Status.MAYBE_NATED.ordinal()) ? -1 : 1 ) * node.getDarknetPortNumber(),
            (opennetStatus.ordinal() < AddressTracker.Status.MAYBE_NATED.ordinal() ? -1 : 1 ) * om.crypto.portNumber };
      }
    }
  }
View Full Code Here

TOP

Related Classes of freenet.io.AddressTracker.Status

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.