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

Function handle_remove_node

modules/clusterer/clusterer.c:1122–1162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1120}
1121
1122static void handle_remove_node(bin_packet_t *packet, cluster_info_t *cl)
1123{
1124 int target_node;
1125 node_info_t *node;
1126 int ev_actions_cl = 1;
1127
1128 bin_pop_int(packet, &target_node);
1129 LM_DBG("Received remove node command for node id: [%d]\n", target_node);
1130
1131 if (db_mode) {
1132 LM_DBG("We are in DB mode, ignoring received remove node command\n");
1133 return;
1134 }
1135
1136 if (target_node == current_id) {
1137 lock_get(cl->current_node->lock);
1138
1139 if (cl->current_node->flags & NODE_STATE_ENABLED) {
1140 cl->current_node->flags &= ~NODE_STATE_ENABLED;
1141 lock_release(cl->current_node->lock);
1142
1143 for (node = cl->node_list; node; node = node->next) {
1144 set_link_w_neigh(LS_DOWN, node);
1145
1146 do_actions_node_ev(cl, &ev_actions_cl, 1);
1147 }
1148 } else {
1149 lock_release(cl->current_node->lock);
1150 }
1151
1152 return;
1153 }
1154
1155 node = get_node_by_id(cl, target_node);
1156 if (!node) {
1157 LM_DBG("Unknown node [%d] to remove\n", target_node);
1158 return;
1159 }
1160
1161 remove_node(cl, node);
1162}
1163
1164void bin_rcv_cl_extra_packets(bin_packet_t *packet, int packet_type,
1165 struct receive_info *ri, void *att)

Callers 1

bin_rcv_cl_extra_packetsFunction · 0.85

Calls 7

bin_pop_intFunction · 0.85
lock_getFunction · 0.85
lock_releaseFunction · 0.85
set_link_w_neighFunction · 0.85
do_actions_node_evFunction · 0.85
get_node_by_idFunction · 0.85
remove_nodeFunction · 0.70

Tested by

no test coverage detected