mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2024-11-19 18:00:39 +01:00
Peer: reimplement getPingTime()
and getLastPingTime()
in a functional way
This commit is contained in:
parent
04c72ce003
commit
98c3a14a54
@ -1578,10 +1578,9 @@ public class Peer extends PeerSocketHandler {
|
||||
/** @deprecated use {@link #lastPingInterval()} */
|
||||
@Deprecated
|
||||
public long getLastPingTime() {
|
||||
Optional<Duration> lastPingInterval = lastPingInterval();
|
||||
return lastPingInterval.isPresent() ?
|
||||
lastPingInterval.get().toMillis() :
|
||||
Long.MAX_VALUE;
|
||||
return lastPingInterval()
|
||||
.map(Duration::toMillis)
|
||||
.orElse(Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1606,10 +1605,9 @@ public class Peer extends PeerSocketHandler {
|
||||
/** @deprecated use {@link #pingInterval()} */
|
||||
@Deprecated
|
||||
public long getPingTime() {
|
||||
Optional<Duration> pingInterval = pingInterval();
|
||||
return pingInterval.isPresent() ?
|
||||
pingInterval.get().toMillis() :
|
||||
Long.MAX_VALUE;
|
||||
return pingInterval()
|
||||
.map(Duration::toMillis)
|
||||
.orElse(Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
private void processPing(Ping m) {
|
||||
|
Loading…
Reference in New Issue
Block a user