Don't ignore transport errors when writing to channel (#804150)
parent
1d6da849c3
commit
8e8214ab77
@ -0,0 +1,34 @@
|
||||
From fed075972080ed705bd79b731c40cf5e73085aeb Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Thu, 15 Mar 2012 13:03:08 +0100
|
||||
Subject: [PATCH] channel_write: acknowledge transport errors
|
||||
|
||||
When draining data off the socket with _libssh2_transport_read() (which
|
||||
in turn has to be done so that we can be sure to have read any possible
|
||||
window-increasing packets), this code previously ignored errors which
|
||||
could lead to nasty loops. Now all error codes except EAGAIN will cause
|
||||
the error to be returned at once.
|
||||
|
||||
Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0068.shtml
|
||||
Reported by: Matthew Booth
|
||||
---
|
||||
src/channel.c | 3 +++
|
||||
1 files changed, 3 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/src/channel.c b/src/channel.c
|
||||
index 8d6fb0a..9e29492 100644
|
||||
--- a/src/channel.c
|
||||
+++ b/src/channel.c
|
||||
@@ -2008,6 +2008,9 @@ _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id,
|
||||
rc = _libssh2_transport_read(session);
|
||||
while (rc > 0);
|
||||
|
||||
+ if((rc < 0) && (rc != LIBSSH2_ERROR_EAGAIN))
|
||||
+ return rc;
|
||||
+
|
||||
if(channel->local.window_size <= 0)
|
||||
/* there's no room for data so we stop */
|
||||
return (rc==LIBSSH2_ERROR_EAGAIN?rc:0);
|
||||
--
|
||||
1.7.1
|
||||
|
Loading…
Reference in new issue