mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-15 03:35:52 +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() {
|
||||
checkNotNull(future, "Already completed");
|
||||
Long elapsed = Utils.currentTimeMillis() - startTimeMsec;
|
||||
Peer.this.addPingTimeData(elapsed);
|
||||
log.debug("{}: ping time is {} msec", Peer.this.toString(), elapsed);
|
||||
future.set(elapsed);
|
||||
future = null;
|
||||
if (!future.isDone()) {
|
||||
Long elapsed = Utils.currentTimeMillis() - startTimeMsec;
|
||||
Peer.this.addPingTimeData(elapsed);
|
||||
log.debug("{}: ping time is {} msec", Peer.this.toString(), elapsed);
|
||||
future.set(elapsed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user