From 500169bf976315f1d829c769917738a6d7832459 Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Mon, 14 Feb 2005 03:16:42 +0000 Subject: [PATCH] Acknowledge window adjustments and fix the paren bug I just introduced :) --- README | 10 ++++++++++ src/channel.c | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README b/README index 3946712..11ac1b7 100644 --- a/README +++ b/README @@ -1,6 +1,16 @@ libssh2 - SSH2 library ====================== +Version 0.7 +----------- + + Fixed extended data identification in libssh2_channel_read(). + + Fixed window adjust code. Hadn't acknowledged adjustments correctly. + + Removed initial_window_size requirement for sending window adjust packet. + + Version 0.6 ----------- diff --git a/src/channel.c b/src/channel.c index 5526969..1c4d91e 100644 --- a/src/channel.c +++ b/src/channel.c @@ -827,7 +827,7 @@ LIBSSH2_API int libssh2_channel_read_ex(LIBSSH2_CHANNEL *channel, int stream_id, * or the standard stream (and data was available), * or the standard stream with extended_data_merge enabled and data was available */ - if ((stream_id && (packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA) && (channel->local.id == libssh2_ntohu32(packet->data + 1) && (stream_id == libssh2_ntohu32(packet->data + 5))) || + if ((stream_id && (packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA) && (channel->local.id == libssh2_ntohu32(packet->data + 1)) && (stream_id == libssh2_ntohu32(packet->data + 5))) || (!stream_id && (packet->data[0] == SSH_MSG_CHANNEL_DATA) && (channel->local.id == libssh2_ntohu32(packet->data + 1))) || (!stream_id && (packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA) && (channel->local.id == libssh2_ntohu32(packet->data + 1)) && (channel->remote.extended_data_ignore_mode == LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE))) { int want = buflen - bytes_read; @@ -864,6 +864,9 @@ LIBSSH2_API int libssh2_channel_read_ex(LIBSSH2_CHANNEL *channel, int stream_id, if (libssh2_packet_write(session, adjust, 9)) { libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND, "Unable to send transfer-window adjustment packet", 0); + } else { + /* Don't forget to acknowledge the adjust on this end */ + channel->remote.window_size += (packet->data_len - (stream_id ? 13 : 9)); } LIBSSH2_FREE(session, packet);