use of tech.pegasys.teku.infrastructure.async.Cancellable in project teku by ConsenSys.
the class Eth2PeerManager method setUpPeriodicTasksForPeer.
private void setUpPeriodicTasksForPeer(Eth2Peer peer) {
Cancellable periodicStatusUpdateTask = periodicallyUpdatePeerStatus(peer);
Cancellable periodicPingTask = periodicallyPingPeer(peer);
peer.subscribeDisconnect((reason, locallyInitiated) -> {
periodicStatusUpdateTask.cancel();
periodicPingTask.cancel();
});
}
use of tech.pegasys.teku.infrastructure.async.Cancellable in project teku by ConsenSys.
the class DiscV5Service method doStop.
@Override
protected SafeFuture<?> doStop() {
final Cancellable refreshTask = this.bootnodeRefreshTask;
this.bootnodeRefreshTask = null;
if (refreshTask != null) {
refreshTask.cancel();
}
discoverySystem.stop();
return SafeFuture.completedFuture(null);
}
use of tech.pegasys.teku.infrastructure.async.Cancellable in project teku by ConsenSys.
the class Eth1StatusLogger method fail.
synchronized void fail() {
if (activeReporter.isEmpty()) {
final UInt64 outageStartInSeconds = timeProvider.getTimeInSeconds();
final Cancellable reporter = asyncRunner.runWithFixedDelay(() -> reportOutage(outageStartInSeconds), LOG_INTERVAL, error -> LOG.error("Failed to check Eth1 status", error));
activeReporter = Optional.of(reporter);
}
}
use of tech.pegasys.teku.infrastructure.async.Cancellable in project teku by ConsenSys.
the class ConnectionManager method doStop.
@Override
protected SafeFuture<?> doStop() {
network.unsubscribeConnect(peerConnectedSubscriptionId);
final Cancellable peerSearchTask = this.periodicPeerSearch;
if (peerSearchTask != null) {
peerSearchTask.cancel();
}
return SafeFuture.COMPLETE;
}
Aggregations