Local window exhaustion -> ConnectionException

This commit is contained in:
Shikhar Bhushan
2011-09-07 21:45:44 +01:00
parent 0937ec9800
commit e66386eb1c

View File

@@ -51,12 +51,13 @@ public abstract class Window {
return size; return size;
} }
public void consume(int dec) { public void consume(int dec)
throws ConnectionException {
synchronized (lock) { synchronized (lock) {
log.debug("Consuming by " + dec + " down to " + size); log.debug("Consuming by " + dec + " down to " + size);
size -= dec; size -= dec;
if (size < 0) 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. */ /** Controls how much data remote end can send before an adjustment notification from us is required. */