From e66386eb1c94718c5635a326a8755e7d07ed2709 Mon Sep 17 00:00:00 2001 From: Shikhar Bhushan Date: Wed, 7 Sep 2011 21:45:44 +0100 Subject: [PATCH] Local window exhaustion -> ConnectionException --- .../net/schmizz/sshj/connection/channel/Window.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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. */