Changeset 7680ecb


Ignore:
Timestamp:
Dec 11, 2015 3:28:39 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
ea9c4a19
Parents:
00a5d195
Message:

Transport: More deadlock prevention (ticket #1722)

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

Legend:

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

    r00a5d195 r7680ecb  
    9393    private FamilyKeyCrypto _familyKeyCrypto;
    9494    private boolean _familyKeyCryptoFail;
     95    public final Object _familyKeyLock = new Object();
    9596   
    9697    public final static String PROP_CONFIG_FILE = "router.configLocation";
     
    878879     */
    879880    public FamilyKeyCrypto getFamilyKeyCrypto() {
    880         synchronized (_routerInfoLock) {
     881        synchronized (_familyKeyLock) {
    881882            if (_familyKeyCrypto == null) {
    882883                if (!_familyKeyCryptoFail) {
     
    919920     *  @return a capabilities string to be added to the RI
    920921     */
    921     String getCapabilities() {
     922    public String getCapabilities() {
    922923        StringBuilder rv = new StringBuilder(4);
    923924        int bwLim = Math.min(_context.bandwidthLimiter().getInboundKBytesPerSecond(),
  • router/java/src/net/i2p/router/transport/TransportImpl.java

    r00a5d195 r7680ecb  
    142142            maxProp = "i2np." + style.toLowerCase(Locale.US) + ".maxConnections";
    143143        int def = MAX_CONNECTION_FACTOR;
    144         RouterInfo ri = _context.router().getRouterInfo();
    145         if (ri != null) {
    146             char bw = ri.getBandwidthTier().charAt(0);
     144        // get it from here, not the RI, to avoid deadlock
     145        String caps = _context.router().getCapabilities();
     146
     147            char bw = caps.charAt(0);
    147148            switch (bw) {
    148149                case Router.CAPABILITY_BW12:
     
    169170                    break;
    170171            }
    171         }
     172
    172173        if (_context.netDb().floodfillEnabled()) {
    173174            // && !SystemVersion.isWindows()) {
     
    748749     *  or after the transport is running.
    749750     *
    750      *  This implementation does nothing. Transports should override if they want notification.
    751      *
    752751     *  @param source defined in Transport.java
    753752     *  @param ip typ. IPv4 or IPv6 non-local; may be null to indicate IPv4 failure or port info only
    754753     *  @param port 0 for unknown or unchanged
    755754     */
    756     public void externalAddressReceived(AddressSource source, byte[] ip, int port) {}
     755    public abstract void externalAddressReceived(AddressSource source, byte[] ip, int port);
    757756
    758757    /**
Note: See TracChangeset for help on using the changeset viewer.