I have code calling libssh2_channel_read_ex()
<http://www.libssh2.org//libssh2_channel_read_ex.html>, requesting small
reads,
typically < 100 bytes. I notice that the receive window size collapses
very quickly, resulting in timeouts when on a high-latency/high-loss
connection, and otherwise running much more slowly than expected.
The attached patch to examples/ssh2_exec.c illustrates the problem.
Manually updating the window, as shown in the #if 0 block, seems
to stabilize the window size, providing a larger window for worse
connections.
Am I using it right? This code in libssh2_channel_read_ex (src/channel.c)
seems to be at fault:
if(buflen > recv_window) {
BLOCK_ADJUST(rc, channel->session,
_libssh2_channel_receive_window_adjust(channel,
buflen,
1, NULL));
}
When buflen is small, recv_window can never get large enough to be useful,
even when libssh2's (256K) input buffer is empty. Is there a recommended
way to keep the window from collapsing, or should clients not be doing
small reads?
This failure did not occur using libssh2-1.2.5. Running the attached code
(altered just enough to be) linked with 1.2.5 does not exhibit the problem.
Nathan Myers
ncm_at_cantrip.org
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel