mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-07 15:50:57 +03:00
Local window exhaustion -> ConnectionException
This commit is contained in:
@@ -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. */
|
||||||
|
|||||||
Reference in New Issue
Block a user