Skip to content

Commit

Permalink
use libqb async API for connect
Browse files Browse the repository at this point in the history
  • Loading branch information
wenningerk committed Jan 14, 2022
1 parent a232b74 commit bd94be0
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/common/ipc_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1407,13 +1407,30 @@ pcmk__ipc_is_authentic_process_active(const char *name, uid_t refuid,
int32_t qb_rc;
pid_t found_pid = 0; uid_t found_uid = 0; gid_t found_gid = 0;
qb_ipcc_connection_t *c;
struct pollfd pollfd = { 0, };
int poll_rc;

c = qb_ipcc_connect(name, 0);
// c = qb_ipcc_connect(name, 0);
c = qb_ipcc_connect_async(name, 0,
&(pollfd.fd));
if (c == NULL) {
crm_info("Could not connect to %s IPC: %s", name, strerror(errno));
rc = pcmk_rc_ipc_unresponsive;
goto bail;
}
pollfd.events = POLLIN;
do {
poll_rc = poll(&pollfd, 1, 2000);
} while ((poll_rc == -1) && (errno == EINTR));
if ((poll_rc <= 0) || (qb_ipcc_connect_continue(c) != 0)) {
crm_info("Could not connect to %s IPC: %s", name,
(poll_rc == 0)?"timeout":strerror(errno));
rc = pcmk_rc_ipc_unresponsive;
if (poll_rc > 0) {
c = NULL; // qb_ipcc_connect_continue cleaned up for us
}
goto bail;
}

qb_rc = qb_ipcc_fd_get(c, &fd);
if (qb_rc != 0) {
Expand Down

0 comments on commit bd94be0

Please sign in to comment.