diff --git a/src/main/java/net/schmizz/sshj/connection/channel/Window.java b/src/main/java/net/schmizz/sshj/connection/channel/Window.java index 79cc02eb..8f34fb35 100644 --- a/src/main/java/net/schmizz/sshj/connection/channel/Window.java +++ b/src/main/java/net/schmizz/sshj/connection/channel/Window.java @@ -51,12 +51,13 @@ public abstract class Window { return size; } - public void consume(int dec) { + public void consume(int dec) + throws ConnectionException { synchronized (lock) { log.debug("Consuming by " + dec + " down to " + size); size -= dec; if (size < 0) - throw new SSHRuntimeException("Window consumed to below 0"); + throw new ConnectionException("Window consumed to below 0"); } } @@ -88,6 +89,14 @@ public abstract class Window { } } + public void consume(int howMuch) { + try { + super.consume(howMuch); + } catch (ConnectionException e) { + throw new SSHRuntimeException(e); + } + } + } /** Controls how much data remote end can send before an adjustment notification from us is required. */