| 351 | } |
| 352 | |
| 353 | static gboolean |
| 354 | try_heartbeat(int command, enum cluster_type_e stack) |
| 355 | { |
| 356 | crm_debug("Attempting to process %c command", command); |
| 357 | |
| 358 | if (command == 'i') { |
| 359 | if (read_local_hb_uuid()) { |
| 360 | crm_exit(0); |
| 361 | } |
| 362 | |
| 363 | } else if (command == 'R') { |
| 364 | if (crmd_remove_node_cache(target_uname)) { |
| 365 | crm_err("Failed to connect to crmd to remove node id %s", target_uname); |
| 366 | crm_exit(-pcmk_err_generic); |
| 367 | } |
| 368 | crm_exit(0); |
| 369 | |
| 370 | } else if (ccm_age_connect(&ccm_fd)) { |
| 371 | int rc = 0; |
| 372 | fd_set rset; |
| 373 | int (*ccm_api_handle_event) (const oc_ev_t * token) = |
| 374 | find_library_function(&ccm_library, CCM_LIBRARY, "oc_ev_handle_event", 1); |
| 375 | |
| 376 | while (1) { |
| 377 | |
| 378 | sleep(1); |
| 379 | FD_ZERO(&rset); |
| 380 | FD_SET(ccm_fd, &rset); |
| 381 | |
| 382 | errno = 0; |
| 383 | rc = select(ccm_fd + 1, &rset, NULL, NULL, NULL); |
| 384 | |
| 385 | if (rc > 0 && (*ccm_api_handle_event) (ccm_token) != 0) { |
| 386 | crm_err("oc_ev_handle_event failed"); |
| 387 | return FALSE; |
| 388 | |
| 389 | } else if (rc < 0 && errno != EINTR) { |
| 390 | crm_perror(LOG_ERR, "select failed: %d", rc); |
| 391 | return FALSE; |
| 392 | } |
| 393 | } |
| 394 | } |
| 395 | return FALSE; |
| 396 | } |
| 397 | #endif |
| 398 | |
| 399 | #if SUPPORT_CMAN |
no test coverage detected