Changeset 7f8efca


Ignore:
Timestamp:
Jul 5, 2013 7:05:54 PM (7 years ago)
Author:
zab2 <zab2@…>
Branches:
master
Children:
bec62c1b
Parents:
76de4fa
Message:

minor cleanup, more to follow

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/streaming/java/src/net/i2p/client/streaming/ConnectionManager.java

    r76de4fa r7f8efca  
    5050    /** cache of the property to detect changes */
    5151    private static volatile String _currentBlacklist = "";
    52     private static final Set<Hash> _globalBlacklist = new ConcurrentHashSet();
     52    private static final Set<Hash> _globalBlacklist = new ConcurrentHashSet<Hash>();
    5353   
    5454    /** @since 0.9.3 */
     
    6363        _defaultOptions = defaultOptions;
    6464        _log = _context.logManager().getLog(ConnectionManager.class);
    65         _connectionByInboundId = new ConcurrentHashMap(32);
    66         _pendingPings = new ConcurrentHashMap(4);
     65        _connectionByInboundId = new ConcurrentHashMap<Long,Connection>(32);
     66        _pendingPings = new ConcurrentHashMap<Long,PingRequest>(4);
    6767        _messageHandler = new MessageHandler(_context, this);
    6868        _packetHandler = new PacketHandler(_context, this);
     
    444444            synchronized(_globalBlacklist) {
    445445                if (hashes.length() > 0) {
    446                     Set<Hash> newSet = new HashSet();
     446                    Set<Hash> newSet = new HashSet<Hash>();
    447447                    StringTokenizer tok = new StringTokenizer(hashes, ",; ");
    448448                    while (tok.hasMoreTokens()) {
     
    548548     */
    549549    public Set<Connection> listConnections() {
    550             return new HashSet(_connectionByInboundId.values());
     550            return new HashSet<Connection>(_connectionByInboundId.values());
    551551    }
    552552
     
    564564     * @param tagsToSend ignored
    565565     */
    566     public boolean ping(Destination peer, long timeoutMs, boolean blocking, SessionKey keyToUse, Set tagsToSend, PingNotifier notifier) {
     566    public boolean ping(Destination peer, long timeoutMs, boolean blocking, SessionKey keyToUse, Set<?> tagsToSend, PingNotifier notifier) {
    567567        return ping(peer, timeoutMs, blocking, notifier);
    568568    }
     
    579579        //    packet.setTagsSent(tagsToSend);
    580580        //}
    581        
    582         PingRequest req = new PingRequest(peer, packet, notifier);
     581        if (_log.shouldLog(Log.INFO)) {
     582            _log.info(String.format("about to ping %s timeout=%d blocking=%b",
     583                    peer,timeoutMs,blocking));
     584        }
     585           
     586       
     587        PingRequest req = new PingRequest(notifier);
    583588       
    584589        _pendingPings.put(id, req);
     
    631636        private final PingNotifier _notifier;
    632637
    633         public PingRequest(Destination peer, PacketLocal packet, PingNotifier notifier) {
     638        public PingRequest(PingNotifier notifier) {
    634639            _notifier = notifier;
    635640        }
     
    639644            //_log.debug("Ping successful");
    640645            //_context.sessionKeyManager().tagsDelivered(_peer.getPublicKey(), _packet.getKeyUsed(), _packet.getTagsSent());
    641             synchronized (ConnectionManager.PingRequest.this) {
     646            synchronized (this) {
    642647                _ponged = true;
    643                 ConnectionManager.PingRequest.this.notifyAll();
     648                notifyAll();
    644649            }
    645650            if (_notifier != null)
    646651                _notifier.pingComplete(true);
    647652        }
    648         public boolean pongReceived() { return _ponged; }
     653        public synchronized boolean pongReceived() { return _ponged; }
    649654    }
    650655   
Note: See TracChangeset for help on using the changeset viewer.