|
|
|
|
@ -392,13 +392,12 @@ static void topo_group_destroy(struct TOPO_GROUP* group) {
|
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_SYS, "[GRP_DESTROY] 4 conn_mgr done"); |
|
|
|
|
|
|
|
|
|
if (group->nodes) { |
|
|
|
|
struct ll_entry* e; int nc = 0; |
|
|
|
|
while ((e = queue_data_get(group->nodes)) != NULL) { |
|
|
|
|
struct TOPO_GROUP_NODE* nq = (struct TOPO_GROUP_NODE*)e; |
|
|
|
|
route_connectivity_cancel_node(group->instance, nq); |
|
|
|
|
if (nq->paths) { queue_free(nq->paths); nq->paths = NULL; } |
|
|
|
|
topo_nodeq_free_group_fields(group->instance->topo_groups, nq); |
|
|
|
|
queue_entry_free(e); nc++; |
|
|
|
|
int nc = 0; |
|
|
|
|
struct ll_entry* e = group->nodes->head; |
|
|
|
|
while (e) { |
|
|
|
|
struct ll_entry* next = e->next; |
|
|
|
|
topo_nodeq_remove_node(group, (struct TOPO_GROUP_NODE*)e); |
|
|
|
|
e = next; nc++; |
|
|
|
|
} |
|
|
|
|
queue_free(group->nodes); |
|
|
|
|
if (nc) DEBUG_INFO(DEBUG_CATEGORY_SYS, "[GRP_DESTROY] 4b nodes cleaned (%d)", nc); |
|
|
|
|
@ -766,11 +765,7 @@ void topo_group_remove_conn(struct TOPO_GROUP* group, struct ETCP_CONN* conn) {
|
|
|
|
|
topo_fire_nodeinfo_cbk(conn->instance, group, nq); |
|
|
|
|
if (group->group_type != TOPO_GROUP_TYPE_CHAT && rt) route_delete(rt, nq); |
|
|
|
|
if (conn->instance && conn->instance->control_srv) control_server_notify_node_removed(conn->instance->control_srv, key); |
|
|
|
|
route_connectivity_cancel_node(conn->instance, nq); |
|
|
|
|
if (nq->paths) { queue_free(nq->paths); nq->paths = NULL; } |
|
|
|
|
topo_nodeq_free_group_fields(group->instance->topo_groups, nq); |
|
|
|
|
struct ll_entry* entry = node_entry; |
|
|
|
|
if (entry) { queue_remove_data(group->nodes, entry); queue_entry_free(entry); } |
|
|
|
|
topo_nodeq_remove_node(group, nq); |
|
|
|
|
nodes_removed++; |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_BGP, "node removed from group: node=%016llx grp=%016llx type=%u ch=%s (link_down)", |
|
|
|
|
(unsigned long long)key, (unsigned long long)group->group_id, group->group_type, group->channel_id); |
|
|
|
|
@ -954,7 +949,6 @@ int topo_group_process_nodeinfo(struct TOPO_GROUP* group, struct ETCP_CONN* from
|
|
|
|
|
struct ll_queue* paths = NULL; |
|
|
|
|
int is_new_node = 0; |
|
|
|
|
if (nodeinfo1) { |
|
|
|
|
topo_nodeq_free_group_fields(group->instance->topo_groups, nodeinfo1); |
|
|
|
|
paths = nodeinfo1->paths; nodeinfo1->paths = NULL; |
|
|
|
|
} else { is_new_node = 1; } |
|
|
|
|
|
|
|
|
|
@ -966,7 +960,7 @@ int topo_group_process_nodeinfo(struct TOPO_GROUP* group, struct ETCP_CONN* from
|
|
|
|
|
uint16_t incoming_cumulative_rtt = 0; |
|
|
|
|
if (topo_node_deserialize(group, ser_data, ser_len, &new_ni, &new_subnets, &new_hop_list, &new_hop_count, &incoming_cumulative_rtt) != 0) { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_BGP, "NODEINFO deserialize failed from %s nid=%016llx", from->log_name, (unsigned long long)node_id); |
|
|
|
|
if (nodeinfo1) { queue_remove_data(group->nodes, &nodeinfo1->ll); queue_free(paths); queue_entry_free(&nodeinfo1->ll); } |
|
|
|
|
if (nodeinfo1) { topo_nodeq_remove_node(group, nodeinfo1); queue_free(paths); } |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
{ int v4c = topo_list_count((struct _topo_head*)new_ni->v4_addrs); |
|
|
|
|
@ -980,7 +974,7 @@ int topo_group_process_nodeinfo(struct TOPO_GROUP* group, struct ETCP_CONN* from
|
|
|
|
|
(unsigned long long)node_id, from->log_name); |
|
|
|
|
topo_node_destroy(group->instance->topo_groups, new_ni); |
|
|
|
|
u_free(new_subnets); u_free(new_hop_list); |
|
|
|
|
if (nodeinfo1) { queue_remove_data(group->nodes, &nodeinfo1->ll); queue_free(paths); queue_entry_free(&nodeinfo1->ll); } |
|
|
|
|
if (nodeinfo1) { topo_nodeq_remove_node(group, nodeinfo1); queue_free(paths); } |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
{ |
|
|
|
|
@ -996,7 +990,7 @@ int topo_group_process_nodeinfo(struct TOPO_GROUP* group, struct ETCP_CONN* from
|
|
|
|
|
(unsigned long long)node_id, ekchk, sig_len, from->log_name); |
|
|
|
|
topo_node_destroy(group->instance->topo_groups, new_ni); |
|
|
|
|
u_free(new_subnets); u_free(new_hop_list); |
|
|
|
|
if (nodeinfo1) { queue_remove_data(group->nodes, &nodeinfo1->ll); queue_free(paths); queue_entry_free(&nodeinfo1->ll); } |
|
|
|
|
if (nodeinfo1) { topo_nodeq_remove_node(group, nodeinfo1); queue_free(paths); } |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_BGP, "NODEINFO x25519_self_sig OK node=%016llx ed_pubkey=%016llx... sig_len=%d from=%s", |
|
|
|
|
@ -1005,6 +999,7 @@ int topo_group_process_nodeinfo(struct TOPO_GROUP* group, struct ETCP_CONN* from
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (nodeinfo1) { |
|
|
|
|
topo_nodeq_free_group_fields(group->instance->topo_groups, nodeinfo1); |
|
|
|
|
{ struct TOPO_NODE* stored = topo_node_registry_store(group->instance->topo_groups, new_ni); |
|
|
|
|
if (stored != new_ni) new_ni = stored; } |
|
|
|
|
nodeinfo1->node_id = new_ni ? new_ni->node_id : 0; |
|
|
|
|
@ -1118,11 +1113,7 @@ int topo_group_process_withdraw(struct TOPO_GROUP* group, struct ETCP_CONN* send
|
|
|
|
|
topo_fire_nodeinfo_cbk(group->instance, group, nq); |
|
|
|
|
if (group->group_type != TOPO_GROUP_TYPE_CHAT && group->instance && group->instance->rt) route_delete(group->instance->rt, nq); |
|
|
|
|
if (group->instance->control_srv) control_server_notify_node_removed(group->instance->control_srv, node_id); |
|
|
|
|
route_connectivity_cancel_node(group->instance, nq); |
|
|
|
|
if (nq->paths) { queue_free(nq->paths); nq->paths = NULL; } |
|
|
|
|
topo_nodeq_free_group_fields(group->instance->topo_groups, nq); |
|
|
|
|
struct ll_entry* entry = queue_find_data_by_index(group->nodes, &node_id); |
|
|
|
|
if (entry) { queue_remove_data(group->nodes, entry); queue_entry_free(entry); } |
|
|
|
|
topo_nodeq_remove_node(group, nq); |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_BGP, "node removed from group: node=%016llx grp=%016llx type=%u ch=%s (withdraw)", |
|
|
|
|
(unsigned long long)node_id, (unsigned long long)group->group_id, group->group_type, group->channel_id); |
|
|
|
|
topo_group_broadcast_withdraw(group, node_id, wd_source, sender); |
|
|
|
|
|