Subject: [libssh2] libssh2_channel_read_ex() non-blocking flaw

[libssh2] libssh2_channel_read_ex() non-blocking flaw

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 13 Aug 2007 00:18:12 +0200 (CEST)

Hi friends,

When getting data over SSH using a channel (RFC4254) we repeatedly send back
window adjustments to the server to let it know how much data we can accept.
That is done by the libssh2_channel_receive_window_adjust() function.

Now, when that function can't complete since it would block it returns and it
then aborts the retrieving of the other possibly pending incoming packages. I
don't think this is the right thing to do. I think it hampers performance to
some degree.

libssh2_channel_receive_window_adjust() returning PACKET_EAGAIN just means
that libssh2 couldn't tell the server about the updated window_size just yet,
but it can still take care of the pending incoming packets.

Making it do this would probably requires three changes:

1) libssh2_channel_receive_window_adjust() would still need to increase our
    window size variable since we're basically are saying that we can deal with
    this much more data, even if that hasn't yet been sent over to the server.

2) Instead of the hideous state check and goto (src/channel.c:1393), it could
    just check channel->adjust_state for an existing pending adjust packet.

3) Make libssh2_channel_receive_window_adjust() deal with the fact that it may
    then be called with further updates before the previously creates adjust
    messages have beent sent off.

Comments on this?

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2007-08-13