This function explicitly creates a cancel socket that can be used in the application.
MCO_RET mco_HA_create_cancel_socket ( mco_db_h db, const char* cancelpoint_addr, /*OUT*/ SOCKET * cancel_socket)
db | The connection to the replica’s database. |
cancelpoint_addr | The connection string for socket. See description for mco_HA_replica_params_t cancelpoint_addr |
cancel_socket | The created cancel socket. |
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/close the cancel_socket
but just use the created socket. In this case the cancelpoint_addr
field in mco_HA_replica_params_t is ignored. If some other thread calls mco_HA_cancel()
, mco_HA_attach_master()
interrupts processing and leaves the cancel socket in the readable state. Application code can then use the cancel socket in select()
or poll()
syscalls.
MCO_S_OK | Successful. |
MCO_E_NW_INVADDR | The cancel_addr doesn't contain a valid connection string |
MCO_E_NW_SOCKET | Error in socket() syscall. |
MCO_E_NW_SOCKOPT | Error in setsocket() syscall |
MCO_E_NW_SOCKIOCTL | Error in ioctl() syscall. |
MCO_E_NW_BIND | Error in bind() syscall. |