| 1153 | #endif |
| 1154 | |
| 1155 | void |
| 1156 | cib_peer_callback(xmlNode * msg, void *private_data) |
| 1157 | { |
| 1158 | const char *reason = NULL; |
| 1159 | const char *originator = crm_element_value(msg, F_ORIG); |
| 1160 | |
| 1161 | if (originator == NULL || crm_str_eq(originator, cib_our_uname, TRUE)) { |
| 1162 | /* message is from ourselves */ |
| 1163 | int bcast_id = 0; |
| 1164 | if (!(crm_element_value_int(msg, F_CIB_LOCAL_NOTIFY_ID, &bcast_id))) { |
| 1165 | check_local_notify(bcast_id); |
| 1166 | } |
| 1167 | return; |
| 1168 | |
| 1169 | } else if (crm_peer_cache == NULL) { |
| 1170 | reason = "membership not established"; |
| 1171 | goto bail; |
| 1172 | } |
| 1173 | |
| 1174 | if (crm_element_value(msg, F_CIB_CLIENTNAME) == NULL) { |
| 1175 | crm_xml_add(msg, F_CIB_CLIENTNAME, originator); |
| 1176 | } |
| 1177 | |
| 1178 | /* crm_log_xml_trace("Peer[inbound]", msg); */ |
| 1179 | cib_process_request(msg, FALSE, TRUE, TRUE, NULL); |
| 1180 | return; |
| 1181 | |
| 1182 | bail: |
| 1183 | if (reason) { |
| 1184 | const char *seq = crm_element_value(msg, F_SEQ); |
| 1185 | const char *op = crm_element_value(msg, F_CIB_OPERATION); |
| 1186 | |
| 1187 | crm_warn("Discarding %s message (%s) from %s: %s", op, seq, originator, reason); |
| 1188 | } |
| 1189 | } |
| 1190 | |
| 1191 | |
| 1192 | #if SUPPORT_HEARTBEAT |
no test coverage detected