]> andersk Git - gssapi-openssh.git/blobdiff - openssh/channels.c
update to http://www.psc.edu/networking/projects/hpn-ssh/openssh-4.7p1-hpn13v1.diff.gz
[gssapi-openssh.git] / openssh / channels.c
index 3c3f04ad81d8928503e98ba9fd5312c6192803f2..2ef1af902fc7a35c1ee546d0bc706355a43e14a9 100644 (file)
@@ -76,7 +76,6 @@
 #include "authfd.h"
 #include "pathnames.h"
 
-
 /* -- channel core */
 
 /*
@@ -771,10 +770,13 @@ int channel_tcpwinsz () {
         u_int32_t tcpwinsz = 0;
         socklen_t optsz = sizeof(tcpwinsz);
        int ret = -1;
+
+       /* if we aren't on a socket return 128KB*/
        if(!packet_connection_is_on_socket()) 
-           return(131072);
+           return(128*1024);
        ret = getsockopt(packet_get_connection_in(),
                         SOL_SOCKET, SO_RCVBUF, &tcpwinsz, &optsz);
+       /* return no more than 64MB */
        if ((ret == 0) && tcpwinsz > BUFFER_MAX_LEN_HPN)
            tcpwinsz = BUFFER_MAX_LEN_HPN;
        debug2("tcpwinsz: %d for connection: %d", tcpwinsz, 
@@ -788,10 +790,8 @@ channel_pre_open(Channel *c, fd_set *readset, fd_set *writeset)
        u_int limit = compat20 ? c->remote_window : packet_get_maxsize();
 
         /* check buffer limits */
-       if (!c->tcpwinsz) 
+       if ((!c->tcpwinsz) || (c->dynamic_window > 0))
            c->tcpwinsz = channel_tcpwinsz();
-       if (c->dynamic_window > 0)
-           c->tcpwinsz = channel_tcpwinsz();
        
        limit = MIN(limit, 2 * c->tcpwinsz);
        
@@ -1689,7 +1689,8 @@ channel_check_window(Channel *c)
                u_int addition = 0;
                /* adjust max window size if we are in a dynamic environment */
                if (c->dynamic_window && (c->tcpwinsz > c->local_window_max)) {
-                       addition = c->tcpwinsz - c->local_window_max;
+                       /* grow the window somewhat aggressively to maintain pressure */
+                       addition = 1.5*(c->tcpwinsz - c->local_window_max);
                        c->local_window_max += addition;
                }
                packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST);
@@ -1902,11 +1903,12 @@ channel_after_select(fd_set *readset, fd_set *writeset)
 
 
 /* If there is data to send to the connection, enqueue some of it now. */
-void
+int
 channel_output_poll(void)
 {
        Channel *c;
        u_int i, len;
+       int packet_length = 0;
 
        for (i = 0; i < channels_alloc; i++) {
                c = channels[i];
@@ -1946,7 +1948,7 @@ channel_output_poll(void)
                                        packet_start(SSH2_MSG_CHANNEL_DATA);
                                        packet_put_int(c->remote_id);
                                        packet_put_string(data, dlen);
-                                       packet_send();
+                                       packet_length = packet_send();
                                        c->remote_window -= dlen + 4;
                                        xfree(data);
                                }
@@ -1976,7 +1978,7 @@ channel_output_poll(void)
                                    SSH2_MSG_CHANNEL_DATA : SSH_MSG_CHANNEL_DATA);
                                packet_put_int(c->remote_id);
                                packet_put_string(buffer_ptr(&c->input), len);
-                               packet_send();
+                               packet_length = packet_send();
                                buffer_consume(&c->input, len);
                                c->remote_window -= len;
                        }
@@ -2011,12 +2013,13 @@ channel_output_poll(void)
                        packet_put_int(c->remote_id);
                        packet_put_int(SSH2_EXTENDED_DATA_STDERR);
                        packet_put_string(buffer_ptr(&c->extended), len);
-                       packet_send();
+                       packet_length = packet_send();
                        buffer_consume(&c->extended, len);
                        c->remote_window -= len;
                        debug2("channel %d: sent ext data %d", c->self, len);
                }
        }
+       return (packet_length);
 }
 
 
@@ -2489,9 +2492,9 @@ channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_por
                /* Allocate a channel number for the socket. */
                /* explicitly test for hpn disabled option. if true use smaller window size */
                if (hpn_disabled)
-                       c = channel_new("port listener", type, sock, sock, -1,
-                         CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,
-                         0, "port listener", 1); 
+               c = channel_new("port listener", type, sock, sock, -1,
+                   CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,
+                   0, "port listener", 1);
                else
                        c = channel_new("port listener", type, sock, sock, -1,
                          hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT,
@@ -2991,11 +2994,12 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost,
        *chanids = xcalloc(num_socks + 1, sizeof(**chanids));
        for (n = 0; n < num_socks; n++) {
                sock = socks[n];
+               /* Is this really necassary? */
                if (hpn_disabled) 
-                       nc = channel_new("x11 listener",
-                           SSH_CHANNEL_X11_LISTENER, sock, sock, -1,
-                           CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT,
-                           0, "X11 inet listener", 1);
+               nc = channel_new("x11 listener",
+                   SSH_CHANNEL_X11_LISTENER, sock, sock, -1,
+                   CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT,
+                   0, "X11 inet listener", 1);
                else 
                        nc = channel_new("x11 listener",
                            SSH_CHANNEL_X11_LISTENER, sock, sock, -1,
This page took 0.035519 seconds and 4 git commands to generate.