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:
parent
9ba11a374c
commit
74f4b7817b
@ -2305,8 +2305,6 @@ channel_close(LIBSSH2_CHANNEL * channel)
|
|||||||
_libssh2_debug(session, LIBSSH2_DBG_CONN, "Closing channel %lu/%lu",
|
_libssh2_debug(session, LIBSSH2_DBG_CONN, "Closing channel %lu/%lu",
|
||||||
channel->local.id, channel->remote.id);
|
channel->local.id, channel->remote.id);
|
||||||
|
|
||||||
channel->local.close = 1;
|
|
||||||
|
|
||||||
channel->close_packet[0] = SSH_MSG_CHANNEL_CLOSE;
|
channel->close_packet[0] = SSH_MSG_CHANNEL_CLOSE;
|
||||||
_libssh2_htonu32(channel->close_packet + 1, channel->remote.id);
|
_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
|
/* We call the callback last in this function to make it keep the local
|
||||||
data as long as EAGAIN is returned. */
|
data as long as EAGAIN is returned. */
|
||||||
if (channel->close_cb) {
|
if (channel->close_cb) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user