Hi,

channel_read() sometimes returns 0 after channel_exec() and loses some data. 
Figured out it was due to channel_read not reading when remote has closed 
connection. Disabling remote closed check in the while loop fixed the issue. 
The diff is attached.

Thank you.

Regards,
Sunjith
Index: packet.c
===================================================================
--- packet.c	(1.1)
+++ packet.c	(new)
@@ -442,7 +442,7 @@
  * _libssh2_packet_add
  *
  * Create a new packet and attach it to the brigade. Called from the transport
- * layer when it as received a packet.
+ * layer when it has received a packet.
  */
 int
 _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
Index: channel.c
===================================================================
--- channel.c	(1.1)
+++ channel.c	(new)
@@ -1794,7 +1794,7 @@
 
     channel->read_packet = session->packets.head;
     while (channel->read_packet &&
-           !channel->remote.close &&
+//           !channel->remote.close &&
            (bytes_read < (int) buflen)) {
         LIBSSH2_PACKET *readpkt = channel->read_packet;
 
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to