Uh, it is important that we don't set the local state 'local.close' to TRUE

until _after_ we're done as otherwise we might not get called again properly
to clean the entire thing since the close state is checked in
libssh2_channel_free
This commit is contained in:
Daniel Stenberg 2009-03-31 08:52:25 +00:00
parent 9ba11a374c
commit 74f4b7817b

View File

@ -2305,8 +2305,6 @@ channel_close(LIBSSH2_CHANNEL * channel)
_libssh2_debug(session, LIBSSH2_DBG_CONN, "Closing channel %lu/%lu",
channel->local.id, channel->remote.id);
channel->local.close = 1;
channel->close_packet[0] = SSH_MSG_CHANNEL_CLOSE;
_libssh2_htonu32(channel->close_packet + 1, channel->remote.id);
@ -2342,6 +2340,10 @@ channel_close(LIBSSH2_CHANNEL * channel)
}
}
/* set the local close state first when we're perfectly confirmed to not
do any more EAGAINs */
channel->local.close = 1;
/* We call the callback last in this function to make it keep the local
data as long as EAGAIN is returned. */
if (channel->close_cb) {