3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-14 19:25:51 +00:00

Fix a bug that would cause ping nonces to always be set to zero, thus screwing up perceived ping times.

This commit is contained in:
Mike Hearn 2013-03-11 15:02:16 +01:00
parent 4d01e107fa
commit fb9bfb960e

View File

@ -894,7 +894,7 @@ public class Peer {
}
if (pingAfterGetData)
sendMessage(new Ping((long) Math.random() * Long.MAX_VALUE));
sendMessage(new Ping((long) (Math.random() * Long.MAX_VALUE)));
}
/**
@ -1150,7 +1150,7 @@ public class Peer {
* @throws ProtocolException if the peer version is too low to support measurable pings.
*/
public ListenableFuture<Long> ping() throws IOException, ProtocolException {
return ping((long) Math.random() * Long.MAX_VALUE);
return ping((long) (Math.random() * Long.MAX_VALUE));
}
protected ListenableFuture<Long> ping(long nonce) throws IOException, ProtocolException {