MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / cib_notify_client

Function cib_notify_client

cib/notify.c:74–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74gboolean
75cib_notify_client(gpointer key, gpointer value, gpointer user_data)
76{
77 const char *type = NULL;
78 gboolean do_send = FALSE;
79
80 cib_client_t *client = value;
81 xmlNode *update_msg = user_data;
82
83 CRM_CHECK(client != NULL, return TRUE);
84 CRM_CHECK(update_msg != NULL, return TRUE);
85
86 if (client->ipc == NULL) {
87 crm_warn("Skipping client with NULL channel");
88 return FALSE;
89 }
90
91 type = crm_element_value(update_msg, F_SUBTYPE);
92
93 CRM_LOG_ASSERT(type != NULL);
94 if (client->diffs && safe_str_eq(type, T_CIB_DIFF_NOTIFY)) {
95 do_send = TRUE;
96
97 } else if (client->replace && safe_str_eq(type, T_CIB_REPLACE_NOTIFY)) {
98 do_send = TRUE;
99
100 } else if (client->confirmations && safe_str_eq(type, T_CIB_UPDATE_CONFIRM)) {
101 do_send = TRUE;
102
103 } else if (client->pre_notify && safe_str_eq(type, T_CIB_PRE_NOTIFY)) {
104 do_send = TRUE;
105
106 } else if (client->post_notify && safe_str_eq(type, T_CIB_POST_NOTIFY)) {
107 do_send = TRUE;
108 }
109
110 if (do_send) {
111 if (client->ipc) {
112 if(crm_ipcs_send(client->ipc, 0, update_msg, TRUE) == FALSE) {
113 crm_warn("Notification of client %s/%s failed", client->name, client->id);
114 }
115
116#ifdef HAVE_GNUTLS_GNUTLS_H
117 } else if (client->session) {
118 crm_debug("Sent %s notification to client %s/%s", type, client->name, client->id);
119 crm_send_remote_msg(client->session, update_msg, client->encrypted);
120
121#endif
122 } else {
123 crm_err("Unknown transport for %s", client->name);
124 }
125 }
126 return FALSE;
127}
128
129void
130cib_pre_notify(int options, const char *op, xmlNode * existing, xmlNode * update)

Callers

nothing calls this directly

Calls 3

crm_element_valueFunction · 0.85
crm_ipcs_sendFunction · 0.85
crm_send_remote_msgFunction · 0.85

Tested by

no test coverage detected