use of tech.pegasys.teku.networking.p2p.rpc.RpcStream in project teku by ConsenSys.
the class Eth2OutgoingRequestHandler method ensureReadCompleteArrivesInTime.
private void ensureReadCompleteArrivesInTime(final RpcStream stream) {
final Duration timeout = RpcTimeouts.RESP_TIMEOUT;
timeoutRunner.getDelayedFuture(timeout).thenAccept((__) -> {
if (!(state.get() == READ_COMPLETE || state.get() == CLOSED)) {
abortRequest(stream, new RpcTimeoutException("Timed out waiting for read channel close", timeout));
}
}).reportExceptions();
}
use of tech.pegasys.teku.networking.p2p.rpc.RpcStream in project teku by ConsenSys.
the class Eth2OutgoingRequestHandler method ensureNextResponseArrivesInTime.
private void ensureNextResponseArrivesInTime(final RpcStream stream, final int previousResponseCount, final AtomicInteger currentResponseCount) {
final Duration timeout = RpcTimeouts.RESP_TIMEOUT;
timeoutRunner.getDelayedFuture(timeout).thenAccept((__) -> {
if (previousResponseCount == currentResponseCount.get()) {
abortRequest(stream, new RpcTimeoutException("Timed out waiting for response chunk " + previousResponseCount, timeout));
}
}).reportExceptions();
}
use of tech.pegasys.teku.networking.p2p.rpc.RpcStream in project teku by ConsenSys.
the class Eth2IncomingRequestHandler method ensureRequestReceivedWithinTimeLimit.
private void ensureRequestReceivedWithinTimeLimit(final RpcStream stream) {
final Duration timeout = RpcTimeouts.RESP_TIMEOUT;
asyncRunner.getDelayedFuture(timeout).thenAccept((__) -> {
if (!requestHandled.get()) {
LOG.debug("Failed to receive incoming request data within {} sec for protocol {}. Close stream.", timeout.getSeconds(), protocolId);
stream.closeAbruptly().reportExceptions();
}
}).reportExceptions();
}
Aggregations