From 84172e5188fb73d719242cf52a29da8d83a27355 Mon Sep 17 00:00:00 2001 From: Salvador Fandino Date: Wed, 11 May 2016 11:56:59 +0200 Subject: [PATCH] LIBSSH2_ERROR_CHANNEL_WINDOW_FULL: add new error code In order to signal that the requested operation can not succeed because the receiving window had been exhausted, the error code LIBSSH2_ERROR_BUFFER_TOO_SMALL has been reused but I have found that in certain context it may be ambigous. This patch introduces a new error code, LIBSSH2_ERROR_CHANNEL_WINDOW_FULL, exclusive to signal that condition. --- include/libssh2.h | 1 + src/channel.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/libssh2.h b/include/libssh2.h index 064f25c2..292e64e7 100644 --- a/include/libssh2.h +++ b/include/libssh2.h @@ -482,6 +482,7 @@ typedef struct _LIBSSH2_POLLFD { #define LIBSSH2_ERROR_ENCRYPT -44 #define LIBSSH2_ERROR_BAD_SOCKET -45 #define LIBSSH2_ERROR_KNOWN_HOSTS -46 +#define LIBSSH2_ERROR_CHANNEL_WINDOW_FULL -47 /* this is a define to provide the old (<= 1.2.7) name */ #define LIBSSH2_ERROR_BANNER_NONE LIBSSH2_ERROR_BANNER_RECV diff --git a/src/channel.c b/src/channel.c index fa7e6d34..b708dd43 100644 --- a/src/channel.c +++ b/src/channel.c @@ -2259,7 +2259,7 @@ static int channel_wait_eof(LIBSSH2_CHANNEL *channel) if ((channel->remote.window_size == channel->read_avail) && session->api_block_mode) - return _libssh2_error(session, LIBSSH2_ERROR_BUFFER_TOO_SMALL, + return _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_WINDOW_FULL, "Receiving channel window has been exhausted"); rc = _libssh2_transport_read(session);