]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Be a little less enthusiastic about sending SSH_MSG_CHANNEL_WINDOW_ADJUST:
authorBen Harris <bjh21@bjh21.me.uk>
Sun, 16 Jan 2005 14:43:12 +0000 (14:43 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Sun, 16 Jan 2005 14:43:12 +0000 (14:43 +0000)
only send it when it will significantly increase the server's idea of our
window.  This avoids the slew of one-byte WINDOW_ADJUSTs that an interactive
shell typically generates.

[originally from svn r5121]

ssh.c

diff --git a/ssh.c b/ssh.c
index e693fb6a9988696907d9e226c6a260ea6acb85ab..7538b559e627bc1bd1f409417eef36692081f805 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -5439,7 +5439,14 @@ static void ssh2_set_window(struct ssh_channel *c, unsigned newwin)
     if (c->closes != 0)
        return;
 
-    if (newwin > c->v.v2.locwindow) {
+    /*
+     * Only send a WINDOW_ADJUST if there's significantly more window
+     * available than the other end thinks there is.  This saves us
+     * sending a WINDOW_ADJUST for every character in a shell session.
+     *
+     * "Significant" is arbitrarily defined as half the window size.
+     */
+    if (newwin > c->v.v2.locwindow * 2) {
        struct Packet *pktout;
 
        pktout = ssh2_pkt_init(SSH2_MSG_CHANNEL_WINDOW_ADJUST);