| 463 | } |
| 464 | |
| 465 | static gboolean |
| 466 | parse_peer_options(int call_type, xmlNode * request, |
| 467 | gboolean * local_notify, gboolean * needs_reply, gboolean * process, |
| 468 | gboolean * needs_forward) |
| 469 | { |
| 470 | const char *op = NULL; |
| 471 | const char *host = NULL; |
| 472 | const char *delegated = NULL; |
| 473 | const char *originator = crm_element_value(request, F_ORIG); |
| 474 | const char *reply_to = crm_element_value(request, F_CIB_ISREPLY); |
| 475 | const char *update = crm_element_value(request, F_CIB_GLOBAL_UPDATE); |
| 476 | |
| 477 | gboolean is_reply = safe_str_eq(reply_to, cib_our_uname); |
| 478 | |
| 479 | if (crm_is_true(update)) { |
| 480 | *needs_reply = FALSE; |
| 481 | if (is_reply) { |
| 482 | *local_notify = TRUE; |
| 483 | crm_trace("Processing global/peer update from %s" |
| 484 | " that originated from us", originator); |
| 485 | } else { |
| 486 | crm_trace("Processing global/peer update from %s", originator); |
| 487 | } |
| 488 | return TRUE; |
| 489 | } |
| 490 | |
| 491 | host = crm_element_value(request, F_CIB_HOST); |
| 492 | if (host != NULL && safe_str_eq(host, cib_our_uname)) { |
| 493 | crm_trace("Processing request sent to us from %s", originator); |
| 494 | return TRUE; |
| 495 | |
| 496 | } else if (host == NULL && cib_is_master == TRUE) { |
| 497 | crm_trace("Processing request sent to master instance from %s", originator); |
| 498 | return TRUE; |
| 499 | } |
| 500 | |
| 501 | op = crm_element_value(request, F_CIB_OPERATION); |
| 502 | if(safe_str_eq(op, "cib_shutdown_req")) { |
| 503 | /* Always process these */ |
| 504 | *local_notify = FALSE; |
| 505 | if(reply_to == NULL || is_reply) { |
| 506 | *process = TRUE; |
| 507 | } |
| 508 | if(is_reply) { |
| 509 | *needs_reply = FALSE; |
| 510 | } |
| 511 | return *process; |
| 512 | } |
| 513 | |
| 514 | if (is_reply) { |
| 515 | crm_trace("Forward reply sent from %s to local clients", originator); |
| 516 | *process = FALSE; |
| 517 | *needs_reply = FALSE; |
| 518 | *local_notify = TRUE; |
| 519 | return TRUE; |
| 520 | } |
| 521 | |
| 522 | delegated = crm_element_value(request, F_CIB_DELEGATED); |
no test coverage detected