mco_HA_create_cancel_socket

This function explicitly creates a cancel socket that can be used in the application.

For an overview, see HA Applications.

Prototype

    MCO_RET mco_HA_create_cancel_socket(mco_db_h db,
        const char* cancelpoint_addr,
        /*OUT*/ SOCKET* cancel_socket);

Arguments

db
The connection to the replica's database.
cancelpoint_addr
The connection string for the socket. See the description for mco_HA_replica_params_t cancelpoint_addr.
cancel_socket
The created cancel socket.

Description

This function explicitly creates a cancel socket that can be used in the application. If the cancel socket was created by this call (and not closed by mco_HA_destroy_cancel_socket()), mco_HA_attach_master() will not create or close the cancel_socket, but instead use the created socket. In this case, the cancelpoint_addr field in mco_HA_replica_params_t is ignored. If another thread calls mco_HA_cancel(), mco_HA_attach_master() interrupts processing and leaves the cancel socket in a readable state. Application code can then use the cancel socket in select() or poll() system calls.

Return Codes

MCO_S_OK
Successful.
MCO_E_NW_INVADDR
The cancelpoint_addr does not contain a valid connection string.
MCO_E_NW_SOCKET
Error in the socket() system call.
MCO_E_NW_SOCKOPT
Error in the setsockopt() system call.
MCO_E_NW_SOCKIOCTL
Error in the ioctl() system call.
MCO_E_NW_BIND
Error in the bind() system call.