Restart member and feedback synchronization over existing transports
This commit is contained in:
1 parent
128c42fa4d
commit
11512970fe
2 files changed
+12
-3
No files matched your search
@@ -786,6 +786,12 @@ int chat_sync_init(struct UTUN_INSTANCE* inst) {
|
||||
chat_admin_init(inst);
|
||||
chat_join_init(inst);
|
||||
|
||||
/* После restart транспорт может уже быть UP: нового conn_up не будет. */
|
||||
if (cs->channel_count) {
|
||||
cs_schedule_sync(cs);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_MEMBER_SYNC, "%s: initial member sync scheduled channels=%d", CS_ID, cs->channel_count);
|
||||
}
|
||||
|
||||
DEBUG_INFO(DEBUG_CATEGORY_MEMBER_SYNC, "%s: initialized", CS_ID);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user