|
|
|
@ -76,6 +76,19 @@ static int wait_ready(struct TOPO_PEER_REQUEST* handle) { |
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "poll network: group readiness timeout phase=%d", topo_group_peer_phase(handle)); return 0; |
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "poll network: group readiness timeout phase=%d", topo_group_peer_phase(handle)); return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* C открывает групповой запрос после входящего UP; до него адрес B ещё не получен. */ |
|
|
|
|
|
|
|
static int wait_transport(struct NODE_CONN_DIRECT* ab, struct NODE_CONN_DIRECT* bc) { |
|
|
|
|
|
|
|
struct ETCP_CONN *a = NULL, *b = NULL; |
|
|
|
|
|
|
|
for (int i = 0; i < 3000; i++) { |
|
|
|
|
|
|
|
a = node_conn_direct_get_conn(ab); b = node_conn_direct_get_conn(bc); |
|
|
|
|
|
|
|
struct ETCP_CONN* c = instance_find_conn(nodes[2], nodes[1]->node_id); |
|
|
|
|
|
|
|
if (a && b && c && a->initialized && b->initialized && c->initialized |
|
|
|
|
|
|
|
&& a->links_up && b->links_up && c->links_up) return 1; |
|
|
|
|
|
|
|
uasync_poll(ua, 5); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_CHAT_SYNC, "poll network: bootstrap timeout ab=%p bc=%p", (void*)a, (void*)b); return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static sqlite3_int64 field(struct UTUN_INSTANCE* inst, const char* json, const char* path) { |
|
|
|
static sqlite3_int64 field(struct UTUN_INSTANCE* inst, const char* json, const char* path) { |
|
|
|
sqlite3_stmt* st = NULL; assert(sqlite3_prepare_v2(inst->topo_sqlite_db, "SELECT json_extract(?1,?2)", -1, &st, NULL) == SQLITE_OK); |
|
|
|
sqlite3_stmt* st = NULL; assert(sqlite3_prepare_v2(inst->topo_sqlite_db, "SELECT json_extract(?1,?2)", -1, &st, NULL) == SQLITE_OK); |
|
|
|
sqlite3_bind_text(st, 1, json, -1, SQLITE_STATIC); sqlite3_bind_text(st, 2, path, -1, SQLITE_STATIC); |
|
|
|
sqlite3_bind_text(st, 1, json, -1, SQLITE_STATIC); sqlite3_bind_text(st, 2, path, -1, SQLITE_STATIC); |
|
|
|
@ -131,6 +144,7 @@ int main(void) { |
|
|
|
} |
|
|
|
} |
|
|
|
seed_members(x, ed, owner_private); |
|
|
|
seed_members(x, ed, owner_private); |
|
|
|
struct NODE_CONN_DIRECT* ab = connect_node(0, 1, ports[1]), *bc = connect_node(1, 2, ports[2]); |
|
|
|
struct NODE_CONN_DIRECT* ab = connect_node(0, 1, ports[1]), *bc = connect_node(1, 2, ports[2]); |
|
|
|
|
|
|
|
assert(wait_transport(ab, bc)); |
|
|
|
struct TOPO_PEER_REQUEST *groups[3] = {0}; uint64_t gid = strtoull(channel, NULL, 10); |
|
|
|
struct TOPO_PEER_REQUEST *groups[3] = {0}; uint64_t gid = strtoull(channel, NULL, 10); |
|
|
|
assert(topo_group_peer_open(topo_groups_find(nodes[0]->topo_groups, gid), nodes[1]->node_id, &groups[0]) == 0); |
|
|
|
assert(topo_group_peer_open(topo_groups_find(nodes[0]->topo_groups, gid), nodes[1]->node_id, &groups[0]) == 0); |
|
|
|
assert(topo_group_peer_open(topo_groups_find(nodes[1]->topo_groups, gid), nodes[2]->node_id, &groups[1]) == 0); |
|
|
|
assert(topo_group_peer_open(topo_groups_find(nodes[1]->topo_groups, gid), nodes[2]->node_id, &groups[1]) == 0); |
|
|
|
|