diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2018-12-10 14:06:55 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-12-10 14:59:21 +0100 |
commit | 1d5b222cc4f1ab03c14932f9e637e957fa8fc21d (patch) | |
tree | f9b0e96fbb47dccaa158164d7d166a7f6b5822a6 /src/channels.c | |
parent | 13b9d268d42b7c34aa5e3e468b53d9735f3d10fb (diff) | |
download | libssh-1d5b222cc4f1ab03c14932f9e637e957fa8fc21d.tar.gz libssh-1d5b222cc4f1ab03c14932f9e637e957fa8fc21d.tar.xz libssh-1d5b222cc4f1ab03c14932f9e637e957fa8fc21d.zip |
channels: Reformat ssh_channel_free()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/channels.c')
-rw-r--r-- | src/channels.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/channels.c b/src/channels.c index c73a6b90..8cdeaba7 100644 --- a/src/channels.c +++ b/src/channels.c @@ -1003,28 +1003,29 @@ error: * * @warning Any data unread on this channel will be lost. */ -void ssh_channel_free(ssh_channel channel) { - ssh_session session; - - if (channel == NULL) { - return; - } +void ssh_channel_free(ssh_channel channel) +{ + ssh_session session; - session = channel->session; - if (session->alive && channel->state == SSH_CHANNEL_STATE_OPEN) { - ssh_channel_close(channel); - } - channel->flags |= SSH_CHANNEL_FLAG_FREED_LOCAL; + if (channel == NULL) { + return; + } - /* 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. - * We definitively close the channel when we receive a close message *and* - * the user closed it. - */ - if((channel->flags & SSH_CHANNEL_FLAG_CLOSED_REMOTE) - || (channel->flags & SSH_CHANNEL_FLAG_NOT_BOUND)){ - ssh_channel_do_free(channel); - } + session = channel->session; + if (session->alive && channel->state == SSH_CHANNEL_STATE_OPEN) { + ssh_channel_close(channel); + } + channel->flags |= SSH_CHANNEL_FLAG_FREED_LOCAL; + + /* 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. + * We definitively close the channel when we receive a close message *and* + * the user closed it. + */ + if ((channel->flags & SSH_CHANNEL_FLAG_CLOSED_REMOTE) || + (channel->flags & SSH_CHANNEL_FLAG_NOT_BOUND)) { + ssh_channel_do_free(channel); + } } /** |