mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-15 11:45:51 +00:00
Lock the ping time accessors correctly.
This commit is contained in:
parent
df1ba42100
commit
93fd045488
@ -818,7 +818,7 @@ public class Peer {
|
|||||||
* Returns the elapsed time of the last ping/pong cycle. If {@link com.google.bitcoin.core.Peer#ping()} has never
|
* Returns the elapsed time of the last ping/pong cycle. If {@link com.google.bitcoin.core.Peer#ping()} has never
|
||||||
* been called or we did not hear back the "pong" message yet, returns {@link Long#MAX_VALUE}.
|
* been called or we did not hear back the "pong" message yet, returns {@link Long#MAX_VALUE}.
|
||||||
*/
|
*/
|
||||||
public long getLastPingTime() {
|
public synchronized long getLastPingTime() {
|
||||||
if (lastPingTimes == null)
|
if (lastPingTimes == null)
|
||||||
return Long.MAX_VALUE;
|
return Long.MAX_VALUE;
|
||||||
return lastPingTimes[lastPingTimes.length - 1];
|
return lastPingTimes[lastPingTimes.length - 1];
|
||||||
@ -829,7 +829,7 @@ public class Peer {
|
|||||||
* been called or we did not hear back the "pong" message yet, returns {@link Long#MAX_VALUE}. The moving average
|
* been called or we did not hear back the "pong" message yet, returns {@link Long#MAX_VALUE}. The moving average
|
||||||
* window is 5 buckets.
|
* window is 5 buckets.
|
||||||
*/
|
*/
|
||||||
public long getPingTime() {
|
public synchronized long getPingTime() {
|
||||||
if (lastPingTimes == null)
|
if (lastPingTimes == null)
|
||||||
return Long.MAX_VALUE;
|
return Long.MAX_VALUE;
|
||||||
long sum = 0;
|
long sum = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user