Changeset dd181a9


Ignore:
Timestamp:
Jul 25, 2013 8:07:12 PM (7 years ago)
Author:
zab2 <zab2@…>
Branches:
master
Children:
b2d72f9
Parents:
a02cc258
Message:

Fix NPE when cancelling PacketLocal?'s

File:
1 edited

Legend:

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

    ra02cc258 rdd181a9  
    3333    private final AtomicInteger _nackCount = new AtomicInteger(0);
    3434    private volatile boolean _retransmitted;
    35     private SimpleTimer2.TimedEvent _resendEvent;
     35    private volatile SimpleTimer2.TimedEvent _resendEvent;
    3636   
    3737    /** not bound to a connection */
     
    113113        _lastSend = _context.clock().now();
    114114    }
     115   
     116    private void cancelResend() {
     117        SimpleTimer2.TimedEvent ev = _resendEvent;
     118        if (ev != null)
     119            ev.cancel();
     120    }
     121   
    115122    public void ackReceived() {
    116123        final long now = _context.clock().now();
     
    121128            notifyAll();
    122129        }
    123         _resendEvent.cancel();
    124     }
     130        cancelResend();
     131    }
     132   
    125133    public void cancelled() {
    126134        synchronized (this) {
     
    129137            notifyAll();
    130138        }
    131         _resendEvent.cancel();
     139       cancelResend();
    132140        if (_log.shouldLog(Log.DEBUG))
    133141            _log.debug("Cancelled! " + toString(), new Exception("cancelled"));
Note: See TracChangeset for help on using the changeset viewer.