| 1120 | } |
| 1121 | |
| 1122 | static 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 | |
| 1164 | void bin_rcv_cl_extra_packets(bin_packet_t *packet, int packet_type, |
| 1165 | struct receive_info *ri, void *att) |
no test coverage detected