Changeset c1b6e1b


Ignore:
Timestamp:
Mar 21, 2016 11:37:24 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
49ff78cf
Parents:
c84dd52
Message:

BuildHandler?: Fix for leaky counter of outstanding lookups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java

    rc84dd52 rc1b6e1b  
    498498            int numTunnels = _context.tunnelManager().getParticipatingCount();
    499499            int limit = Math.max(MIN_LOOKUP_LIMIT, Math.min(MAX_LOOKUP_LIMIT, numTunnels * PERCENT_LOOKUP_LIMIT / 100));
    500             int current = _currentLookups.incrementAndGet();
     500            int current;
     501            // leaky counter, since it isn't reliable
     502            if (_context.random().nextInt(16) > 0)
     503                current = _currentLookups.incrementAndGet();
     504            else
     505                current = 1;
    501506            if (current <= limit) {
     507                // don't let it go negative
     508                if (current <= 0)
     509                    _currentLookups.set(1);
    502510                if (_log.shouldLog(Log.DEBUG))
    503511                    _log.debug("Request " + req
     
    511519                    _log.warn("Drop next hop lookup, limit " + limit + ": " + req);
    512520                _context.statManager().addRateData("tunnel.dropLookupThrottle", 1);
    513             }
    514             if (from != null)
    515                 _context.commSystem().mayDisconnect(from);
     521                if (from != null)
     522                    _context.commSystem().mayDisconnect(from);
     523            }
    516524            return -1;
    517525        } else {
Note: See TracChangeset for help on using the changeset viewer.