gboolean vortex_connection_reconnect VortexConnection connection,
VortexConnectionNew  on_connected,
gpointer  user_data
 

Allows to reconnect the given connection, using actual connection settings.

Given a connection that is actually broken, this function can be used to reconnect it trying to find, on the same host and port, the peer that the connection was linked to.

The connection "reconnected" will keep the connection identifier, any data set on this connection using the vortex_connection_set_data and vortex_connection_set_data_full functions, the connection reference count and remote profiles read.

If the function detect that the given connection is currently working and connected then the function does nothing.

Here is an example:

 // check if the connection is broken, maybe remote site have
 // failed.
 if (! vortex_connection_is_ok (connection, FALSE)) {
       // connection is not available, try to reconnect.
       if (! vortex_connection_reconnect (connection,
                                          // no async notify
                                          NULL,
                                          // no user data
                                          NULL)) {
            g_print ("Link failure detected..");
       }else {
            g_print ("Unable to reconnect to remote site..");
       }
 } // end if

Parameters:
connection The connection to reconnect to.
on_connected Optional handler. This function works as vortex_connection_new. This handler can be defined to notify when the connection has been reconnected.
user_data User defined data to be passed to on_connected.
Returns:
TRUE if the connection was successfully reconnected or FALSE if not. If the on_connected handler is defined, this function will always return TRUE.