Hello list members,I recently run into troubles when sending data in non-blocking mode with SCP. Googling around, I found that a mail has been sent to Daniel about this issue last year (one year and a week ago exactly!), here it is:
http://daniel.haxx.se/projects/libssh2/mail/libssh2-devel-archive-2008-02/0000.shtml
Apparently, this patch has not been merged for some reasons. However, one has been commited four days ago: http://sourceforge.net/mailarchive/forum.php?thread_name=E1LW8TS-0005eX-4s%40ddv4jf1.ch3.sourceforge.com&forum_name=libssh2-cvs
This last patch looks incomplete, indeed, substracting channel->write_bufwrote to buflen does not seem enough, you also want to add channel->write_bufwrote to buf to use the part of the buffer not yet sent.
The patch enclosed fixes this issue, and applies to the CVS. I have also added a missing LIBSS2_FREE, like the year old patch.
Regards, Romain Bondue
--- channel.c.orig 2009-02-12 11:49:30.000000000 +0100 +++ channel.c 2009-02-12 11:59:16.000000000 +0100 @@ -1771,8 +1771,9 @@ channel->write_state = libssh2_NB_state_allocated; } - /* deduct the amount thet has already been sent */ + /* Deduct the amount that has already been sent, and set buf accordingly. */ buflen -= channel->write_bufwrote; + buf += channel->write_bufwrote; while (buflen > 0) { if (channel->write_state == libssh2_NB_state_allocated) { @@ -1798,6 +1799,7 @@ if (rc < 0) { /* Error or EAGAIN occurred, disconnect? */ if (rc != PACKET_EAGAIN) { + LIBSSH2_FREE(session, channel->write_packet); channel->write_state = libssh2_NB_state_idle; } return rc;
------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________ libssh2-devel mailing list libssh2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libssh2-devel