Fixed potential race condition identified in #203

This commit is contained in:
Jeroen van Erp
2016-03-18 13:11:59 +01:00
parent 4f152749ce
commit 3c230a0fc4

View File

@@ -130,7 +130,12 @@ public final class ChannelInputStream
buf.putRawBytes(data, offset, len);
buf.notifyAll();
}
// Potential fix for #203 (window consumed below 0).
// This seems to be a race condition if we receive more data, while we're already sending a SSH_MSG_CHANNEL_WINDOW_ADJUST
// And the window has not expanded yet.
synchronized (win) {
win.consume(len);
}
if (chan.getAutoExpand())
checkWindow();
}