Another transport layer fix for bogus -39 (LIBSSH2_ERROR_BAD_USE) errors

Commit 683aa0f6b5 made send_existing() send
more than just the second part of a packet when the kernel did not accept
the full packet, but the function still overlooked the SSH protocol
overhead in each packet, often 48 bytes.

If only the last few bytes of a packet remained, then the packet would
erroneously be considered completely sent, and the next call to write
more data in the session would return a -39 error.
This commit is contained in:
Peter Stuge 2009-12-08 07:33:05 +01:00
parent 95f559a926
commit 1256c61815

View File

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