axl_bool vortex_connection_reconnect ( VortexConnection connection,
VortexConnectionNew  on_connected,
axlPointer  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, axl_false)) {
       // connection is not available, try to reconnect.
       if (! vortex_connection_reconnect (connection,
                                          // no async notify
                                          // no user data
                                          NULL)) {
            printf ("Link failure detected..");
       }else {
            printf ("Unable to reconnect to remote site..");
 } // end if

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.
axl_true if the connection was successfully reconnected or axl_false if not. If the on_connected handler is defined, this function will always return axl_true.