From 1711917c2ce7e16e3ff08c3280272092d307372e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Mar 2010 23:11:23 +0100 Subject: [PATCH] Reduce used window sizes by factor 10 As reported in bug report #166 http://libssh2.stuge.se/ticket/166 by 'ptjm', the maximum window size must be less crazy for libssh2 to do better with more server implementations. I did not do any testing to see how this changes raw SCP performance, but the maximum window size is still almost 4MB. This also has the upside that libssh2 will use less memory. --- src/channel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/channel.c b/src/channel.c index ad9de5e..b53872d 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1821,7 +1821,7 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id, more off the network again */ channel->read_state = libssh2_NB_state_created; - if(channel->remote.window_size < (LIBSSH2_CHANNEL_WINDOW_DEFAULT*300)) { + if(channel->remote.window_size < (LIBSSH2_CHANNEL_WINDOW_DEFAULT*30)) { /* the window is getting too narrow, expand it! */ channel_read_ex_point1: @@ -1829,7 +1829,7 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id, /* the actual window adjusting may not finish so we need to deal with this special state here */ rc = _libssh2_channel_receive_window_adjust(channel, - (LIBSSH2_CHANNEL_WINDOW_DEFAULT*600), 0, NULL); + (LIBSSH2_CHANNEL_WINDOW_DEFAULT*60), 0, NULL); if (rc == PACKET_EAGAIN) return rc;