conn_mgr: кандидаты-посредники из topo_node-списка (активные соединения); гейт md_super_connect по is_supernode; откат ping→best_candidates
This commit is contained in:
1 parent
2045d4a169
commit
265008961a
3 files changed
+15
-4
No files matched your search
@@ -1204,7 +1204,7 @@ static void md_on_props_changed(uint64_t node_id, const char* adm_tags, const ch
|
||||
|
||||
if (node_id == md->self_node_id) {
|
||||
media_delivery_set_supernode(md->inst, is_super);
|
||||
} else {
|
||||
} else if (md->is_supernode) {
|
||||
if (is_super) md_super_connect(md, node_id, strtoull(channel_id, NULL, 10));
|
||||
else md_super_peer_remove(md, node_id);
|
||||
}
|
||||
|
||||
@@ -167,6 +167,20 @@ void cm_candidate_ping_timer_cb(void* arg) {
|
||||
}
|
||||
mgr->candidate_ping_wait = NULL;
|
||||
#endif
|
||||
/* Кандидаты-посредники выводятся из topo_node-списка группы: добавляем все
|
||||
* узлы с активным соединением (посредник должен быть напрямую связан с нами). */
|
||||
{
|
||||
struct ll_entry* e = mgr->group->nodes ? mgr->group->nodes->head : NULL;
|
||||
while (e) {
|
||||
struct TOPO_GROUP_NODE* nq = (struct TOPO_GROUP_NODE*)e;
|
||||
if (nq->node_id != mgr->instance->node_id && cm_has_active_conn(mgr->group, nq->node_id)) {
|
||||
uint16_t rtt = topo_get_chain_rtt(nq);
|
||||
if (rtt == 0 || rtt == 0xFFFF) rtt = 1;
|
||||
conn_mgr_update_best_candidates(mgr, nq->node_id, rtt);
|
||||
}
|
||||
e = e->next;
|
||||
}
|
||||
}
|
||||
for (uint8_t i = 0; i < mgr->best_candidate_count; i++) {
|
||||
uint64_t nid = mgr->best_candidates[i].node_id;
|
||||
struct TOPO_GROUP_NODE* nq = topo_node_find_by_id(mgr->group, nid);
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "config_parser.h"
|
||||
#include "topo_node.h"
|
||||
#include "topo_group.h"
|
||||
#include "conn_mgr.h"
|
||||
#include "route_lib.h"
|
||||
#include "etcp_debug.h"
|
||||
#include "topo_node_sqlite.h"
|
||||
@@ -581,8 +580,6 @@ void topo_node_ping_update_rtt(struct TOPO_GROUPS* groups, uint64_t node_id, uin
|
||||
nq->connectivity.real_min_rtt = rtt;
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_BGP, "ping_update_rtt: node=%016llx rtt=%u (%llu) group=%016llx",
|
||||
(unsigned long long)node_id, (unsigned)rtt, (unsigned long long)now, (unsigned long long)g->group_id);
|
||||
if (g->conn_mgr)
|
||||
conn_mgr_update_best_candidates(g->conn_mgr, node_id, rtt);
|
||||
if (groups->instance && groups->instance->topo_sqlite_db)
|
||||
topo_node_sqlite_update_rtt(groups->instance->topo_sqlite_db, node_id, rtt);
|
||||
topo_fire_nodeinfo_cbk(groups->instance, g, nq);
|
||||
|
||||
Reference in new issue
Block a user