My fault, I don't see the source code when i am at home last night.
I have test your patch, the problem still exists.
In the function _libssh2_channel_receive_**window_adjust() there's a call to
> _libssh2_transport_send(). If this transport function returns EAGAIN, then
> that will be returned from the receive window function. All other errors
> will cause a LIBSSH2_ERROR_SOCKET_SEND to get returned.
>
Yes, the return code of _libssh2_channel_receive_**window_adjust() is
LIBSSH2_ERROR_SOCKET_SEND
because we are blocking in the last call. then function
_libssh2_channel_read() will ignore LIBSSH2_ERROR_SOCKET_SEND, set
channel->read_state = libssh2_NB_state_created;
In the next call to _libssh2_channel_read() ,this will occur again because
we are blocking again in previous _libssh2_channel_write(). .
The receiving-window-adjust packet has no chance to be sent.
In my first patch for this problem i send the receiving-window-adjust
packet in _libssh2_channel_write(), the packet can be sent before
we are blocking, see:
http://www.libssh2.org/mail/libssh2-devel-archive-2011-08/0110.shtml
Second, if _libssh2_channel_receive_window_adjust() return EAGAIN, caller
will get a big problem.
We will lose data we have just read from session->packets. In the next call
to sftp_packet_read() we will get an
error LIBSSH2_ERROR_CHANNEL_PACKET_EXCEEDED.
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-09-09