initiate_connection

March 26, 2020 Contributors

Name

initiate_connection — Intiate an outbound connection

Synopsis

#include "connection.h"

| connection_handle * **initiate_connection** ( | dr, |   |
|   | binding, |   |
|   | now, |   |
|   | finish_connect_func, |   |
|   | timeout_func, |   |
|   | user_data, |   |
|   | error); |   |

domain_record * <var class="pdparam">dr</var>;
int <var class="pdparam">binding</var>;
struct timeval * <var class="pdparam">now</var>;
EventFunc <var class="pdparam">finish_connect_func</var>;
EventFunc <var class="pdparam">timeout_func</var>;
void * <var class="pdparam">user_data</var>;
int * <var class="pdparam">error</var>;

Description

Note

This reference page was automatically generated from functions found in the header files in the development branch. The function described here may not exist in generally available versions of Momentum, and may change in behavior when it is generally available. Consult your vendor for definitive advice on the use of this function.

Intiate an outbound connection

This function initiates an outbound connection. It either returns a connection handle or sets error; if error contains one of the CONN_ACTION_* flags, the called needs to take the specified action on the binding,domain it was called on: CONN_ACTION_REQUEUE1: take a message from the active queue and requeue it CONN_ACTION_PURGE_DOMAIN: purge the entire domain (not just one binding) In case of error, the caller is also responsible for checking of MX_Failures_To_Delay has been exceeded and taking the appropriate action.

Parameters

dr

The domain record on which a connection is to be opened.

binding

The binding slot on which a connection is to be opened.

now

The current time.

finish_connect_func

This function is called if the connection attempt succeeeds, or if it fails after connect() returns EINPROGRESS and we receive an error (as opposed to timing out).

timeout_func

This function is called if the connection attempt times out.

user_data

This is set as the user_data in the resulting connection.

error

If NULL is returned, this is set to a CONN_ERR_* possibly ORed with a CONN_ACTION_*

Return Values

On success the connection handle is returned; on error, NULL.