mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-15 11:45:51 +00:00
Peer: don't null out the future object to avoid a race where the pong can be received before the ping call has returned.
This commit is contained in:
parent
d6ed5069d4
commit
ce50e0b755
@ -1379,12 +1379,12 @@ public class Peer extends PeerSocketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void complete() {
|
public void complete() {
|
||||||
checkNotNull(future, "Already completed");
|
if (!future.isDone()) {
|
||||||
Long elapsed = Utils.currentTimeMillis() - startTimeMsec;
|
Long elapsed = Utils.currentTimeMillis() - startTimeMsec;
|
||||||
Peer.this.addPingTimeData(elapsed);
|
Peer.this.addPingTimeData(elapsed);
|
||||||
log.debug("{}: ping time is {} msec", Peer.this.toString(), elapsed);
|
log.debug("{}: ping time is {} msec", Peer.this.toString(), elapsed);
|
||||||
future.set(elapsed);
|
future.set(elapsed);
|
||||||
future = null;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user