From b6ed60d2ccb32452e4727f7b2da1f3052f0e63b5 Mon Sep 17 00:00:00 2001 From: Peter Stuge Date: Sun, 28 Mar 2010 00:50:49 +0100 Subject: [PATCH] Correctly clear blocking flag after sending multipart packet commit 7317edab61d2179febc38a2c2c4da0b951d74cbc cleared the outbound blocking bit when send_existing() returned PACKET_NONE and *ret=0, as opposed to before even calling send_existing(), but because *ret=1 when sending parts 2..n of an existing packet, the bit would only be cleared when calling libssh2_transport_write() for a new packet. Clear the direction flag after the final part of a packet has been sent. --- src/transport.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/transport.c b/src/transport.c index 43df76c..605e002 100644 --- a/src/transport.c +++ b/src/transport.c @@ -708,13 +708,14 @@ _libssh2_transport_write(LIBSSH2_SESSION * session, unsigned char *data, /* FIRST, check if we have a pending write to complete */ rc = send_existing(session, data, data_len, &ret); - if (rc || ret) { + if (rc) return rc; - } - /* default clear the bit */ session->socket_block_directions &= ~LIBSSH2_SESSION_BLOCK_OUTBOUND; + if (ret) + return rc; + encrypted = (session->state & LIBSSH2_STATE_NEWKEYS) ? 1 : 0; /* check if we should compress */