Changeset 829eb665 for router


Ignore:
Timestamp:
Sep 22, 2018 12:13:51 PM (22 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
3b38f5a
Parents:
4369b7d
Message:

NTCP: Fix handling of multiple connections,
change termination code for expired RI, log tweaks

Location:
router/java/src/net/i2p/router
Files:
4 edited

Legend:

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

    r4369b7d r829eb665  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 4;
     21    public final static long BUILD = 5;
    2222
    2323    /** for example "-test" */
    24     public final static String EXTRA = "";
     24    public final static String EXTRA = "-rc";
    2525    public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
    2626    public static void main(String args[]) {
  • router/java/src/net/i2p/router/transport/ntcp/InboundEstablishState.java

    r4369b7d r829eb665  
    10031003        } catch (IllegalArgumentException iae) {
    10041004            // hash collision?
    1005             _msg3p2FailReason = NTCPConnection.REASON_UNSPEC;
    1006             throw new DataFormatException("RI store fail", iae);
     1005            // expired RI?
     1006            _msg3p2FailReason = NTCPConnection.REASON_MSG3;
     1007            throw new DataFormatException("RI store fail: " + ri, iae);
    10071008        }
    10081009        _con.setRemotePeer(_aliceIdent);
  • router/java/src/net/i2p/router/transport/ntcp/NTCPConnection.java

    r4369b7d r829eb665  
    489489        NTCPConnection toClose = locked_close(allowRequeue);
    490490        if (toClose != null && toClose != this) {
     491            // won't happen as of 0.9.37
    491492            if (_log.shouldLog(Log.WARN))
    492493                _log.warn("Multiple connections on remove, closing " + toClose + " (already closed " + this + ")");
     
    508509
    509510    /**
    510      * @return a second connection with the same peer...
     511     * @return usually this, but could be a second connection with the same peer...
     512     *         only this or null as of 0.9.37
    511513     */
    512514    private synchronized NTCPConnection locked_close(boolean allowRequeue) {
     
    18351837        }
    18361838        NTCPConnection toClose = _transport.inboundEstablished(this);
    1837         if (toClose != null) {
    1838             if (_log.shouldLog(Log.DEBUG))
    1839                 _log.debug("Old connection closed: " + toClose + " replaced by " + this);
     1839        if (toClose != null && toClose != this) {
     1840            if (_log.shouldWarn())
     1841                _log.warn("Old connection closed: " + toClose + " replaced by " + this);
    18401842            _context.statManager().addRateData("ntcp.inboundEstablishedDuplicate", toClose.getUptime());
    18411843            toClose.close();
     
    21082110                }
    21092111            } catch (IllegalArgumentException iae) {
    2110                 throw new DataFormatException("RI store fail", iae);
     2112                throw new DataFormatException("RI store fail: " + ri, iae);
    21112113            }
    21122114        }
  • router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java

    r4369b7d r829eb665  
    7474    private final SharedBid _transientFail;
    7575    private final Object _conLock;
    76     private final Map<Hash, NTCPConnection> _conByIdent;
     76    private final ConcurrentHashMap<Hash, NTCPConnection> _conByIdent;
    7777    private final EventPumper _pumper;
    7878    private final Reader _reader;
     
    642642    /**
    643643     * @return usually the con passed in, but possibly a second connection with the same peer...
     644     *         only con or null as of 0.9.37
    644645     */
    645646    NTCPConnection removeCon(NTCPConnection con) {
     
    648649        if (ident != null) {
    649650            synchronized (_conLock) {
    650                 removed = _conByIdent.remove(ident.calculateHash());
     651                // only remove the con passed in
     652                //removed = _conByIdent.remove(ident.calculateHash());
     653                if (_conByIdent.remove(ident.calculateHash(), con))
     654                    removed = con;
    651655            }
    652656        }
Note: See TracChangeset for help on using the changeset viewer.