mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-30 19:41:24 +00:00
Peer.PendingPing: Make future final.
This commit is contained in:
@@ -1496,21 +1496,21 @@ public class Peer extends PeerSocketHandler {
|
|||||||
|
|
||||||
private class PendingPing {
|
private class PendingPing {
|
||||||
// The future that will be invoked when the pong is heard back.
|
// The future that will be invoked when the pong is heard back.
|
||||||
public SettableFuture<Long> future;
|
public final SettableFuture<Long> future;
|
||||||
// The random nonce that lets us tell apart overlapping pings/pongs.
|
// The random nonce that lets us tell apart overlapping pings/pongs.
|
||||||
public final long nonce;
|
public final long nonce;
|
||||||
// Measurement of the time elapsed.
|
// Measurement of the time elapsed.
|
||||||
public final long startTimeMsec;
|
public final long startTimeMsec;
|
||||||
|
|
||||||
public PendingPing(long nonce) {
|
public PendingPing(long nonce) {
|
||||||
future = SettableFuture.create();
|
this.future = SettableFuture.create();
|
||||||
this.nonce = nonce;
|
this.nonce = nonce;
|
||||||
startTimeMsec = Utils.currentTimeMillis();
|
this.startTimeMsec = Utils.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void complete() {
|
public void complete() {
|
||||||
if (!future.isDone()) {
|
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);
|
||||||
|
Reference in New Issue
Block a user