On Wed, 17 Oct 2012, Maxime Larocque wrote:

If the received length is shorter than requested, it just reduce the filep->offset_sent. This is wrong, since offset_sent has already been used to send requests. If this happens, the file will be missing a chunk. What OpenSSH does in this case is to resend the request with the missing length. I do not know if a lot of servers answers with data shorter than requested...

You're right. But the fix is a bit harder than "just that" because libssh2 does use speculative read-ahead and adding a separate read for a gap in the middle will require some proper considerations.

I've basically held off trying to do that since I don't have a reliable (and repeatable) set of test cases to use for verification.

But by all means, if you're up to it please go ahead and make an attempt!

In reality, I've only seen a short read happen on the very last read for a file. I suppose you could make it happen if you for example try to read from /dev/random on the remote host or something. Ie from a file/pipe that provides data slowly.

--

 / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to