Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,18 @@ public void onMessage(@NotNull Stream stream, Circuit.HopMessage msg) {

// connect these streams with time + bytes enforcement
fromRequestor.pushHandler(new InboundTrafficLimitHandler(resv.maxBytes));
fromRequestor.pushHandler(
new TotalTimeoutHandler(
Duration.of(resv.durationSeconds, ChronoUnit.SECONDS)));
if(resv.durationSeconds > 0){
fromRequestor.pushHandler(
new TotalTimeoutHandler(
Duration.of(resv.durationSeconds, ChronoUnit.SECONDS)));
}

toTarget.pushHandler(new InboundTrafficLimitHandler(resv.maxBytes));
toTarget.pushHandler(
new TotalTimeoutHandler(
Duration.of(resv.durationSeconds, ChronoUnit.SECONDS)));
if(resv.durationSeconds > 0){
toTarget.pushHandler(
new TotalTimeoutHandler(
Duration.of(resv.durationSeconds, ChronoUnit.SECONDS)));
}
fromRequestor.pushHandler(new ProxyHandler(toTarget));
toTarget.pushHandler(new ProxyHandler(fromRequestor));
} else {
Expand Down
Loading