connect_sync


Description:

public virtual bool connect_sync (NamedParameters? credentials, out SourceAuthenticationResult out_auth_result, out string out_certificate_pem, out TlsCertificateFlags out_certificate_errors, Cancellable? cancellable = null) throws Error

This is called always before any operation which requires a connection to the remote side.

It can fail with an REPOSITORY_OFFLINE error to indicate that the remote side cannot be currently reached. Other errors are propagated to the caller/client side. This method is not called when the backend is offline.

The descendant should also call set_writable after successful connect to the remote side. This value is stored for later use, when being opened offline.

The credentials parameter consists of the previously used credentials. It's always null with the first connection attempt. To get the credentials, just set the out_auth_result to e_source_authentication_required for the first time and the function will be called again once the credentials are available. See the documentation of SourceAuthenticationResult for other available results.

The out parameters are passed to schedule_credentials_required and are ignored when the descendant returns true, aka they are used only if the connection fails. The out_certificate_pem and out_certificate_errors should be used together and they can be left untouched if the failure reason was not related to certificate. Use out_auth_result e_source_authentication_unknown to indicate other error than credentials error, otherwise the throws is used according to out_auth_result value.

It is mandatory to implement this virtual method by the descendant.

Parameters:

this

an CalMetaBackend

credentials

an NamedParameters with previously used credentials, or null

out_auth_result

an SourceAuthenticationResult with an authentication result

out_certificate_pem

a PEM encoded certificate on failure, or null

out_certificate_errors

a TlsCertificateFlags on failure, or 0

cancellable

optional Cancellable object, or null

Returns:

Whether succeeded.