VortexConnection * vortex_tls_start_negotiation_sync ( VortexConnection connection,
const char *  serverName,
VortexStatus status,
char **  status_message 
)

Allows to start a TLS profile negotiation in a synchronous way (blocking the caller).

This actually uses vortex_tls_start_negotiation. Check out vortex_tls_start_negotiation documentation to know more about activating TLS profile.

If TLS profile is not supported the function returns the same connection received. A call to vortex_tls_init is required before calling to this function.

Parameters
connectionThe connection where the TLS profile negotiation will take place.
serverNameOptional serverName value to request remote peer to act as a particular server.
statusAn optional reference to a VortexStatus variable so the caller could get a TLS activation status.
status_messageAn optional reference to get a textual diagnostic about TLS activation status.
Returns
The new connection with TLS profile activated or the same connection if TLS activation failed.

NOTE: About connection reference returned

The function always return a reference to a connection, even on TLS failures. Assuming this, it is required to call to vortex_connection_is_ok to check status and proceed as required in the case an error was found. The same can be done using status or status_message parameters (checking state).

Because the function could fail before the TLS handshake can start or during it, the function returns the same connection if the failure was found before TLS started or a different connection reference (with the same data) if the error is found during the tuning. In both cases a valid reference may be returned.

References vortex_async_queue_new(), vortex_async_queue_ref(), vortex_async_queue_timedpop(), vortex_async_queue_unref(), vortex_connection_get_ctx(), vortex_connection_get_id(), vortex_connection_get_timeout(), vortex_connection_is_ok(), vortex_connection_set_data_full(), vortex_timeval_substract(), vortex_tls_start_negotiation(), and VortexError.