gboolean vortex_connection_close VortexConnection connection  ) 
 

Tries to close properly a connection and all channels inside it.

This function close a connection and unref it using vortex_connection_unref.

Because there can be channels created and still working this function will try to close them by executing vortex_channel_close on them. If vortex_channel_close fails for one of them, the vortex_connection_close will be stopped and the connection will not be closed.

Do not call this function twice because a unref operations is performed over the connection if the function returns TRUE. This means after calling this function the connection reference must not be used until a new connection is created. Otherwise a segfault may happen.

If the function receives a null connection reference, it will just return a TRUE value without doing nothing.

Parameters:
connection the connection to close properly.
Returns:
TRUE if connection was closed and FALSE if not. If there are channels still working, the connection will not be closed.