Changeset 44edf70


Ignore:
Timestamp:
Aug 13, 2012 11:06:07 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
523d39b, 65efefb
Parents:
16a46b3
Message:
Location:
router/java/src/net/i2p/router
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/RouterVersion.java

    r16a46b3 r44edf70  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 8;
     21    public final static long BUILD = 9;
    2222
    2323    /** for example "-test" */
  • router/java/src/net/i2p/router/transport/udp/EstablishmentManager.java

    r16a46b3 r44edf70  
    779779        int port = reader.getRelayResponseReader().readCharliePort();
    780780        if (_log.shouldLog(Log.INFO))
    781             _log.info("Received relay intro for " + state.getRemoteIdentity().calculateHash() + " - they are on "
     781            _log.info("Received RelayResponse for " + state.getRemoteIdentity().calculateHash() + " - they are on "
    782782                      + addr.toString() + ":" + port + " (according to " + bob + ")");
    783783        RemoteHostId oldId = state.getRemoteHostId();
    784784        state.introduced(addr, ip, port);
    785         _outboundStates.remove(oldId);
    786         _outboundStates.put(state.getRemoteHostId(), state);
     785        RemoteHostId newId = state.getRemoteHostId();
     786        // Swap out the RemoteHostId the state is indexed under
     787        // TODO only if !oldId.equals(newId) ? synch?
     788        OutboundEstablishState oldState = _outboundStates.remove(oldId);
     789        _outboundStates.put(newId, state);
     790        if (_log.shouldLog(Log.DEBUG))
     791            _log.debug("RR replaced " + oldId + " -> " + oldState + " with " + newId + " -> " + state);
    787792        notifyActivity();
    788793    }
     
    10361041                boolean expired = outboundState.getLifetime() > MAX_OB_ESTABLISH_TIME;
    10371042                switch (outboundState.getState()) {
    1038                     case OB_STATE_UNKNOWN:
     1043                    case OB_STATE_UNKNOWN:  // fall thru
     1044                    case OB_STATE_INTRODUCED:
    10391045                        if (expired)
    10401046                            processExpired(outboundState);
  • router/java/src/net/i2p/router/transport/udp/InboundEstablishState.java

    r16a46b3 r44edf70  
    371371    public String toString() {           
    372372        StringBuilder buf = new StringBuilder(128);
    373         buf.append(super.toString());
     373        buf.append("IES ").append(super.toString());
    374374        if (_receivedX != null)
    375375            buf.append(" ReceivedX: ").append(Base64.encode(_receivedX, 0, 4));
     
    380380        buf.append(" RelayTag: ").append(_sentRelayTag);
    381381        buf.append(" SignedOn: ").append(_sentSignedOnTime);
    382         buf.append(" state: ").append(_currentState);
     382        buf.append(' ').append(_currentState);
    383383        return buf.toString();
    384384    }
  • router/java/src/net/i2p/router/transport/udp/OutboundEstablishState.java

    r16a46b3 r44edf70  
    8080        OB_STATE_CONFIRMED_COMPLETELY,
    8181        /** we need to have someone introduce us to the peer, but haven't received a RelayResponse yet */
    82         OB_STATE_PENDING_INTRO
     82        OB_STATE_PENDING_INTRO,
     83        /** RelayResponse received */
     84        OB_STATE_INTRODUCED
    8385    }
    8486   
     
    106108        _introKey = introKey;
    107109        _queuedMessages = new LinkedBlockingQueue();
    108         _currentState = OutboundState.OB_STATE_UNKNOWN;
    109110        _establishBegin = ctx.clock().now();
    110111        _remoteAddress = addr;
     
    117118                _log.debug("new outbound establish to " + remotePeer.calculateHash() + ", with address: " + addr);
    118119            _currentState = OutboundState.OB_STATE_PENDING_INTRO;
     120        } else {
     121            _currentState = OutboundState.OB_STATE_UNKNOWN;
    119122        }
    120123    }
     
    195198                       + "\nthis: " + this.toString());
    196199       
    197         if ( (_currentState == OutboundState.OB_STATE_UNKNOWN) || (_currentState == OutboundState.OB_STATE_REQUEST_SENT) )
     200        if (_currentState == OutboundState.OB_STATE_UNKNOWN ||
     201            _currentState == OutboundState.OB_STATE_REQUEST_SENT ||
     202            _currentState == OutboundState.OB_STATE_INTRODUCED ||
     203            _currentState == OutboundState.OB_STATE_PENDING_INTRO)
    198204            _currentState = OutboundState.OB_STATE_CREATED_RECEIVED;
    199205        packetReceived();
     
    401407        if (_log.shouldLog(Log.DEBUG))
    402408            _log.debug("Send confirm packets, nextSend in " + delay);
    403         if ( (_currentState == OutboundState.OB_STATE_UNKNOWN) ||
    404              (_currentState == OutboundState.OB_STATE_REQUEST_SENT) ||
    405              (_currentState == OutboundState.OB_STATE_CREATED_RECEIVED) )
     409        if (_currentState == OutboundState.OB_STATE_UNKNOWN ||
     410            _currentState == OutboundState.OB_STATE_PENDING_INTRO ||
     411            _currentState == OutboundState.OB_STATE_INTRODUCED ||
     412            _currentState == OutboundState.OB_STATE_REQUEST_SENT ||
     413            _currentState == OutboundState.OB_STATE_CREATED_RECEIVED)
    406414            _currentState = OutboundState.OB_STATE_CONFIRMED_PARTIALLY;
    407415    }
     
    427435        if (_log.shouldLog(Log.DEBUG))
    428436            _log.debug("Send a request packet, nextSend in " + delay);
    429         if (_currentState == OutboundState.OB_STATE_UNKNOWN)
     437        if (_currentState == OutboundState.OB_STATE_UNKNOWN ||
     438            _currentState == OutboundState.OB_STATE_INTRODUCED)
    430439            _currentState = OutboundState.OB_STATE_REQUEST_SENT;
    431440    }
     
    473482            return; // we've already successfully been introduced, so don't overwrite old settings
    474483        _nextSend = _context.clock().now() + 500; // wait briefly for the hole punching
    475         if (_currentState == OutboundState.OB_STATE_PENDING_INTRO) {
    476             // OB_STATE_UNKNOWN will probe the EstablishmentManager to send a new
    477             // session request to this newly known address
    478             _currentState = OutboundState.OB_STATE_UNKNOWN;
    479         }
     484        _currentState = OutboundState.OB_STATE_INTRODUCED;
    480485        _bobIP = bobIP;
    481486        _bobPort = bobPort;
     
    508513    @Override
    509514    public String toString() {
    510         return "OES " + _remoteHostId;
     515        return "OES " + _remoteHostId + ' ' + _currentState;
    511516    }
    512517}
Note: See TracChangeset for help on using the changeset viewer.