On Thu, 7 Oct 2010, Thomas Rauscher wrote:

 * _libssh2_transport_write then returns "wrote" (12k) to
the application.

Right, as it did in fact successfully send away 12K.

I think that this is the core problem. The code has sent away 12k, but failed to send the rest. It saves the 12k-Buffer to odata and the upper level function _libssh2_channel_write throws it away again. This means that this buffer is missing in the SSH stream.

When libssh2_channel_write_ex() returns 12K and thus informs the application that 12K data was indeed sent, the appliction will advance its pointer and the next call will be 12K further into the data.

Thus, the application will deliver the rest of the data (again) and libssh2 won't need to have it buffered anywhere. That buffer is only needed and used as long as it truly and only gets EAGAIN back from the socket.

A short send() is very common for anything except very small files when sent over a slower network, so I don't think it is "just" that's required to trigger this.

--

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

Reply via email to