Fix transport layer bug causing invalid -39 (LIBSSH2_ERROR_BAD_USE) errors

The channel layer sends packets using the transport layer, possibly
calling _libssh2_transport_write() many times for each packet.

The transport layer uses the send_existing() helper to send out any
remaining parts of previous packets before a new packet is started.

The bug made send_existing() consider the entire packet sent as soon as it
successfully sent the second part of a packet, even if the packet was not
completely done yet.
This commit is contained in:
Peter Stuge 2009-09-19 23:42:32 +02:00
parent 7a9d36903a
commit 683aa0f6b5

View File

@ -626,7 +626,7 @@ send_existing(LIBSSH2_SESSION * session, unsigned char *data,
p->osent += rc; /* we sent away this much data */
return PACKET_NONE;
return p->osent < data_len ? PACKET_EAGAIN : PACKET_NONE;
}
/*