Subject: Re: [libssh2] SFTP Blocking Reads and Writes

Re: [libssh2] SFTP Blocking Reads and Writes

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 27 Feb 2007 16:00:50 +0100 (CET)

On Sun, 25 Feb 2007, Lucas Newman wrote:

> I've noticed that the new sftp_readnb and sftp_writenb functions don't
> ever seem to block.

I take it you meant that it always blocks...

> Looking through the code, I think the reason is because _libssh2_sftp_read,
> the internal function for reading, calls libssh2_sftp_packet_requirev to
> acquire the data packet, which in turn calls libssh2_sftp_packet_read in
> blocking mode. This means that the entire data packet will be read in
> blocking mode, which is the behavior I am observing.
>
> Is this the correct assessment, or am I crazy?

Sounds like you're on the right path.

For the *readnb() case, we need to rip out usage of the *requirev() functions
and instead properly check for the packages it wants and return (with an
*EAGAIN return code) if they're not present and make sure we use a state
machine to deal with incomplete reads until they are complete.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2007-02-27