|
|
|
|
@ -70,7 +70,8 @@ static struct NODE_CONN_DIRECT* connect_node(int from, int to, unsigned port) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int wait_ready(struct TOPO_PEER_REQUEST* handle) { |
|
|
|
|
for (int i = 0; i < 3000; i++) { |
|
|
|
|
uint64_t deadline = get_time_tb() + 15u * 10000u; |
|
|
|
|
while (get_time_tb() < deadline) { |
|
|
|
|
if (topo_group_peer_phase(handle) == TOPO_PEER_READY) return 1; |
|
|
|
|
uasync_poll(ua, 5); |
|
|
|
|
} |
|
|
|
|
@ -80,7 +81,8 @@ static int wait_ready(struct TOPO_PEER_REQUEST* handle) {
|
|
|
|
|
/* 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++) { |
|
|
|
|
uint64_t deadline = get_time_tb() + 15u * 10000u; |
|
|
|
|
while (get_time_tb() < deadline) { |
|
|
|
|
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 |
|
|
|
|
@ -97,7 +99,8 @@ static sqlite3_int64 field(struct UTUN_INSTANCE* inst, const char* json, const c
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int wait_result(int index, int voters, int option_one, int reactions) { |
|
|
|
|
for (int i = 0; i < 3000; i++) { |
|
|
|
|
uint64_t deadline = get_time_tb() + 15u * 10000u; |
|
|
|
|
while (get_time_tb() < deadline) { |
|
|
|
|
char* result = NULL; |
|
|
|
|
if (chat_feedback_snapshot(nodes[index], channel, message_id, &result) == 0) { |
|
|
|
|
int ok = !field(nodes[index], result, "$.pending") && field(nodes[index], result, "$.poll.voters") == voters |
|
|
|
|
|