1
1

channels: Reformat ssh_channel_free()

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
Andreas Schneider 2018-12-10 14:06:55 +01:00
родитель 13b9d268d4
Коммит 1d5b222cc4

Просмотреть файл

@ -1003,28 +1003,29 @@ error:
* *
* @warning Any data unread on this channel will be lost. * @warning Any data unread on this channel will be lost.
*/ */
void ssh_channel_free(ssh_channel channel) { void ssh_channel_free(ssh_channel channel)
ssh_session session; {
ssh_session session;
if (channel == NULL) { if (channel == NULL) {
return; return;
} }
session = channel->session; session = channel->session;
if (session->alive && channel->state == SSH_CHANNEL_STATE_OPEN) { if (session->alive && channel->state == SSH_CHANNEL_STATE_OPEN) {
ssh_channel_close(channel); ssh_channel_close(channel);
} }
channel->flags |= SSH_CHANNEL_FLAG_FREED_LOCAL; channel->flags |= SSH_CHANNEL_FLAG_FREED_LOCAL;
/* The idea behind the flags is the following : it is well possible /* The idea behind the flags is the following : it is well possible
* that a client closes a channel that stills exists on the server side. * that a client closes a channel that stills exists on the server side.
* We definitively close the channel when we receive a close message *and* * We definitively close the channel when we receive a close message *and*
* the user closed it. * the user closed it.
*/ */
if((channel->flags & SSH_CHANNEL_FLAG_CLOSED_REMOTE) if ((channel->flags & SSH_CHANNEL_FLAG_CLOSED_REMOTE) ||
|| (channel->flags & SSH_CHANNEL_FLAG_NOT_BOUND)){ (channel->flags & SSH_CHANNEL_FLAG_NOT_BOUND)) {
ssh_channel_do_free(channel); ssh_channel_do_free(channel);
} }
} }
/** /**