Ejemplo n.º 1
0
  /* FIXME missing hashCode() method FIXME */
  @Override
  public boolean equals(Object object) {
    if ((object != null) && (object instanceof SessionConfig)) {
      SessionConfig cfg = (SessionConfig) object;
      return DataHelper.eq(getSignature(), cfg.getSignature())
          && DataHelper.eq(getDestination(), cfg.getDestination())
          && DataHelper.eq(getCreationDate(), cfg.getCreationDate())
          && DataHelper.eq(getOptions(), cfg.getOptions());
    }

    return false;
  }
 void sessionEstablished(SessionConfig config) {
   _destHashCache = config.getDestination().calculateHash();
   if (_log.shouldLog(Log.DEBUG))
     _log.debug("SessionEstablished called for destination " + _destHashCache.toBase64());
   _config = config;
   // We process a few options here, but most are handled by the tunnel manager.
   // The ones here can't be changed later.
   Properties opts = config.getOptions();
   if (opts != null) {
     _dontSendMSM =
         "none".equals(opts.getProperty(I2PClient.PROP_RELIABILITY, "").toLowerCase(Locale.US));
     _dontSendMSMOnReceive = Boolean.parseBoolean(opts.getProperty(I2PClient.PROP_FAST_RECEIVE));
   }
   // per-destination session key manager to prevent rather easy correlation
   if (_sessionKeyManager == null) {
     int tags = TransientSessionKeyManager.DEFAULT_TAGS;
     int thresh = TransientSessionKeyManager.LOW_THRESHOLD;
     if (opts != null) {
       String ptags = opts.getProperty(PROP_TAGS);
       if (ptags != null) {
         try {
           tags = Integer.parseInt(ptags);
         } catch (NumberFormatException nfe) {
         }
       }
       String pthresh = opts.getProperty(PROP_THRESH);
       if (pthresh != null) {
         try {
           thresh = Integer.parseInt(pthresh);
         } catch (NumberFormatException nfe) {
         }
       }
     }
     _sessionKeyManager = new TransientSessionKeyManager(_context, tags, thresh);
   } else {
     _log.error(
         "SessionEstablished called for twice for destination "
             + _destHashCache.toBase64().substring(0, 4));
   }
   _manager.destinationEstablished(this);
 }