I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit b2d72f90 authored by kytv's avatar kytv
Browse files

merge of '5ad8235a14f2f52799755969e5c877f4f1c159cc'

     and 'f5d75b2ebc648c43182d685f30e96242e43caa69'
parents 19faa352 dd181a90
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ class PacketLocal extends Packet implements MessageOutputStream.WriteStatus {
private long _cancelledOn;
private final AtomicInteger _nackCount = new AtomicInteger(0);
private volatile boolean _retransmitted;
private SimpleTimer2.TimedEvent _resendEvent;
private volatile SimpleTimer2.TimedEvent _resendEvent;
/** not bound to a connection */
public PacketLocal(I2PAppContext ctx, Destination to) {
......@@ -112,6 +112,13 @@ class PacketLocal extends Packet implements MessageOutputStream.WriteStatus {
_numSends++;
_lastSend = _context.clock().now();
}
private void cancelResend() {
SimpleTimer2.TimedEvent ev = _resendEvent;
if (ev != null)
ev.cancel();
}
public void ackReceived() {
final long now = _context.clock().now();
synchronized (this) {
......@@ -120,15 +127,16 @@ class PacketLocal extends Packet implements MessageOutputStream.WriteStatus {
releasePayload();
notifyAll();
}
_resendEvent.cancel();
cancelResend();
}
public void cancelled() {
synchronized (this) {
_cancelledOn = _context.clock().now();
releasePayload();
notifyAll();
}
_resendEvent.cancel();
cancelResend();
if (_log.shouldLog(Log.DEBUG))
_log.debug("Cancelled! " + toString(), new Exception("cancelled"));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment