1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-10-31 23:30:25 +03:00

_libssh2_channel_write: revert channel_write() use

The attempts made to have _libssh2_channel_write() accept larger pieces
of data and split up the data by itself into 32700 byte chunks and pass
them on to channel_write() in a loop as a way to do faster operations on
larger data blocks was a failed attempt.

The reason why it is difficult:

The API only allows EAGAIN or a length to be returned. When looping over
multiple blocks to get sent, one block can get sent and the next might
not. And yet: when transport_send() has returned EAGAIN we must not call
it again with new data until it has returned OK on the existing data it
is still working on. This makes it a mess and we do get a much easier
job by simply returning the bytes or EAGAIN at once, as in the EAGAIN
case we can assume that we will be called with the same arguments again
and transport_send() will be happy.

Unfortunately, I think we take a small performance hit by not being able
to do this.
This commit is contained in:
Daniel Stenberg
2010-11-13 23:13:21 +01:00
parent ac6d0fb706
commit b215ec0af5
2 changed files with 29 additions and 97 deletions

View File

@@ -396,10 +396,6 @@ struct _LIBSSH2_CHANNEL
size_t write_packet_len;
size_t write_bufwrite;
int transport_streamid;
const unsigned char *transport_buf;
size_t transport_buflen;
/* State variables used in libssh2_channel_close() */
libssh2_nonblocking_states close_state;
unsigned char close_packet[5];