| 327 | } |
| 328 | |
| 329 | static void |
| 330 | do_local_notify(xmlNode * notify_src, const char *client_id, |
| 331 | gboolean sync_reply, gboolean from_peer) |
| 332 | { |
| 333 | /* send callback to originating child */ |
| 334 | cib_client_t *client_obj = NULL; |
| 335 | int local_rc = pcmk_ok; |
| 336 | |
| 337 | if (client_id != NULL) { |
| 338 | client_obj = g_hash_table_lookup(client_list, client_id); |
| 339 | } else { |
| 340 | crm_trace("No client to sent the response to. F_CIB_CLIENTID not set."); |
| 341 | } |
| 342 | |
| 343 | if (client_obj == NULL) { |
| 344 | local_rc = -ECONNRESET; |
| 345 | |
| 346 | } else { |
| 347 | int rid = 0; |
| 348 | |
| 349 | if(sync_reply) { |
| 350 | CRM_LOG_ASSERT(client_obj->request_id); |
| 351 | |
| 352 | rid = client_obj->request_id; |
| 353 | client_obj->request_id = 0; |
| 354 | |
| 355 | crm_trace("Sending response %d to %s %s", |
| 356 | rid, client_obj->name, from_peer?"(originator of delegated request)":""); |
| 357 | |
| 358 | } else { |
| 359 | crm_trace("Sending an event to %s %s", |
| 360 | client_obj->name, from_peer?"(originator of delegated request)":""); |
| 361 | } |
| 362 | |
| 363 | if (client_obj->ipc && crm_ipcs_send(client_obj->ipc, rid, notify_src, !sync_reply) < 0) { |
| 364 | local_rc = -ENOMSG; |
| 365 | |
| 366 | #ifdef HAVE_GNUTLS_GNUTLS_H |
| 367 | } else if (client_obj->session) { |
| 368 | crm_send_remote_msg(client_obj->session, notify_src, client_obj->encrypted); |
| 369 | #endif |
| 370 | } else if(client_obj->ipc == NULL) { |
| 371 | crm_err("Unknown transport for %s", client_obj->name); |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | if (local_rc != pcmk_ok && client_obj != NULL) { |
| 376 | crm_warn("%sSync reply to %s failed: %s", |
| 377 | sync_reply ? "" : "A-", |
| 378 | client_obj ? client_obj->name : "<unknown>", pcmk_strerror(local_rc)); |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | static void |
| 383 | local_notify_destroy_callback(gpointer data) |
no test coverage detected