On Fri, 9 Sep 2011, liuzl wrote:
> Like this: download a file in non-block mode, offered a receive buffer 1MB.
> 1), call libssh2_sftp_read()
> a), sftp_read() will package many READ packets.
> b), sftp_read() send READ packets until block.
> c), sftp_read() ask for ACK
> packet:sftp_read()->sftp_packet_requirev()->sftp_packet_read()->_libssh2_channel_read()
Oh yes. This is not good. We must better acknowledge EAGAIN and not continue
working elsewhere after it has been returned.
I think we need to make sure that we remake the sftp_read() function to
instead work like this:
LOOP {
send READ packet
if EAGAIN, break loop
check for incoming READ RESPONSEs
if EAGAIN, break loop
}
The current way of doing things is with two separate loops, first all the
READs and then all check the respones but that isn't good since the READs will
often end with EAGAIN and then we really can't continue to handle the
responses very good.
I'll work on making a patch for this.
-- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-develReceived on 2011-09-09