gboolean vortex_channel_close VortexChannel channel,
VortexOnClosedNotification  on_closed
 

Close the given channel.

Free all resource allocated by channel and tries to close it if is opened. Once you have called this function, the channel will no longer be available until it is created again. Once the channel is closed, this function will notify vortex session (the connection associated with this channel) to remove this channel reference from it.

In some cases the channel close request that is function issue could be denied. This is because the channel close process may be denied from other side so channel close couldn't be done. This may happen if other side have something remaining to be sent while you are trying to close. This means the function will block you until channel close process reply is receive and then returned to you.

Of course you can avoid get blocked on channel close by setting the on_close_notification which is called at the end of the process, notifying if channel was closed or not.

On both models, making the blocking close operation or the non-blocking one using the on_close_notification, if channel is closed, channel resources will be freed so channel pointer provided will no longer pointing to a valid channel.

Another thing about channel close process to keep in mind it that close handler defined at vortex_channel_new or at vortex_profiles_register is NOT executed when vortex_channel_close is called. Those handlers are actually executed when your channel receive a close indication. This also means this function sends a close indication to remote peer so, if remote peer is also a vortex enabled and have a close handler defined, then it will be executed.

There are an exception to keep in mind. Channel 0 can not be closed using this function. This channel is hard wired to actual session so, there is no reason to support closing channel 0. Channel 0 is closed on session close. If you still want to close channel 0 call vortex_connection_close instead.

During the on_closed handler execution, if defined, you can still get access to the channel being closed. This is provided because you may be interesting on getting the channel status, etc. After on_closed is executed and finished, the channel resources are deallocated.

Parameters:
channel the channel to free
on_closed a optional handler notification
Returns:
TRUE if the channel was closed or FALSE if not. On threaded mode, activated by defining the on_closed handler, always return TRUE. Actual close process result is notified on on_closed