MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / match_node

Function match_node

modules/clusterer/node_info.c:1212–1244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1210}
1211
1212int match_node(const node_info_t *a, const node_info_t *b,
1213 enum cl_node_match_op match_op)
1214{
1215 switch (match_op) {
1216 case NODE_CMP_ANY:
1217 case NODE_CMP_ALL:
1218 break;
1219 case NODE_CMP_EQ_SIP_ADDR:
1220 lock_get(a->lock);
1221 if (!a->sip_addr.s || !b->sip_addr.s ||
1222 str_strcmp(&a->sip_addr, &b->sip_addr)) {
1223 lock_release(a->lock);
1224 return 0;
1225 }
1226 lock_release(a->lock);
1227 break;
1228 case NODE_CMP_NEQ_SIP_ADDR:
1229 lock_get(a->lock);
1230 if (!a->sip_addr.s || !b->sip_addr.s ||
1231 !str_strcmp(&a->sip_addr, &b->sip_addr)) {
1232 lock_release(a->lock);
1233 return 0;
1234 }
1235 lock_release(a->lock);
1236 break;
1237 default:
1238 LM_BUG("unknown match_op: %d\n", match_op);
1239 return 0;
1240 }
1241
1242 LM_DBG("matched node %d\n", b->node_id);
1243 return 1;
1244}

Callers 4

get_sync_sourceFunction · 0.85
clusterer_bcast_msgFunction · 0.85
handle_cap_updateFunction · 0.85
do_actions_node_evFunction · 0.85

Calls 2

lock_getFunction · 0.85
lock_releaseFunction · 0.85

Tested by

no test coverage detected