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

Function get_clusterer_nodes

modules/clusterer/node_info.c:1045–1072  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1043}
1044
1045clusterer_node_t* get_clusterer_nodes(int cluster_id)
1046{
1047 clusterer_node_t *ret_nodes = NULL;
1048 node_info_t *node;
1049 cluster_info_t *cl;
1050
1051 lock_start_read(cl_list_lock);
1052
1053 cl = get_cluster_by_id(cluster_id);
1054 if (!cl) {
1055 LM_ERR("cluster id: %d not found!\n", cluster_id);
1056 lock_stop_read(cl_list_lock);
1057 return NULL;
1058 }
1059 for (node = cl->node_list; node; node = node->next)
1060 if (get_next_hop(node) > 0)
1061 if (add_clusterer_node(&ret_nodes, node) < 0) {
1062 lock_stop_read(cl_list_lock);
1063 LM_ERR("Unable to add node: %d to the returned list of reachable nodes\n",
1064 node->node_id);
1065 free_clusterer_nodes(ret_nodes);
1066 return NULL;
1067 }
1068
1069 lock_stop_read(cl_list_lock);
1070
1071 return ret_nodes;
1072}
1073
1074clusterer_node_t *api_get_next_hop(int cluster_id, int node_id)
1075{

Callers

nothing calls this directly

Calls 4

get_cluster_by_idFunction · 0.85
get_next_hopFunction · 0.85
add_clusterer_nodeFunction · 0.85
free_clusterer_nodesFunction · 0.85

Tested by

no test coverage detected