You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.4 KiB
46 lines
1.4 KiB
From d0a263ef805244245afd9b709bdd3dc733113a6c Mon Sep 17 00:00:00 2001
|
|
From: Daniel Stenberg <daniel@haxx.se>
|
|
Date: Sat, 7 Sep 2013 13:41:14 +0200
|
|
Subject: [PATCH 06/11] _libssh2_channel_write: client spins on write when window full
|
|
|
|
When there's no window to "write to", there's no point in waiting for
|
|
the socket to become writable since it most likely just will continue to
|
|
be.
|
|
|
|
Patch-by: ncm
|
|
Fixes #258
|
|
|
|
[upstream commit e6c46cc249227de7b7cd136d72eded5dcb3f9381]
|
|
|
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
---
|
|
src/channel.c | 10 +++++++++-
|
|
1 files changed, 9 insertions(+), 1 deletions(-)
|
|
|
|
diff --git a/src/channel.c b/src/channel.c
|
|
index 9f2c241..74262d8 100644
|
|
--- a/src/channel.c
|
|
+++ b/src/channel.c
|
|
@@ -2039,9 +2039,17 @@ _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id,
|
|
if((rc < 0) && (rc != LIBSSH2_ERROR_EAGAIN))
|
|
return rc;
|
|
|
|
- if(channel->local.window_size <= 0)
|
|
+ if(channel->local.window_size <= 0) {
|
|
/* there's no room for data so we stop */
|
|
+
|
|
+ /* Waiting on the socket to be writable would be wrong because we
|
|
+ * would be back here immediately, but a readable socket might
|
|
+ * herald an incoming window adjustment.
|
|
+ */
|
|
+ session->socket_block_directions = LIBSSH2_SESSION_BLOCK_INBOUND;
|
|
+
|
|
return (rc==LIBSSH2_ERROR_EAGAIN?rc:0);
|
|
+ }
|
|
|
|
channel->write_bufwrite = buflen;
|
|
|
|
--
|
|
1.7.1
|
|
|