| 662 | } |
| 663 | |
| 664 | mainloop_io_t * |
| 665 | mainloop_add_ipc_client( |
| 666 | const char *name, int priority, size_t max_size, void *userdata, struct ipc_client_callbacks *callbacks) |
| 667 | { |
| 668 | mainloop_io_t *client = NULL; |
| 669 | crm_ipc_t *conn = crm_ipc_new(name, max_size); |
| 670 | |
| 671 | if(conn && crm_ipc_connect(conn)) { |
| 672 | int32_t fd = crm_ipc_get_fd(conn); |
| 673 | client = mainloop_add_fd(name, priority, fd, userdata, NULL); |
| 674 | client->ipc = conn; |
| 675 | client->destroy_fn = callbacks->destroy; |
| 676 | client->dispatch_fn_ipc = callbacks->dispatch; |
| 677 | } |
| 678 | |
| 679 | if(conn && client == NULL) { |
| 680 | crm_trace("Connection to %s failed", name); |
| 681 | crm_ipc_close(conn); |
| 682 | crm_ipc_destroy(conn); |
| 683 | } |
| 684 | |
| 685 | return client; |
| 686 | } |
| 687 | |
| 688 | void |
| 689 | mainloop_del_ipc_client(mainloop_io_t *client) |
no test coverage detected