cleanup: skip a do_gc iteration before removing peers marked for deletion

This fixes an issue with events where we try to make queries on peers
that no longer exist internally
This commit is contained in:
jfreegman 2024-01-16 13:11:52 -05:00
parent 16809dc36e
commit 21a8ff5895
No known key found for this signature in database
GPG Key ID: 3627F3144076AE63
3 changed files with 21 additions and 13 deletions

View File

@ -1 +1 @@
0b58b866f87d92267db4577d26eebe10dcf5a96ff53ac5a863dade83f471961c /usr/local/bin/tox-bootstrapd
738c98673260593fc150b8d5b0cb770cd521f469b4eb04c873f19d89bb7238cf /usr/local/bin/tox-bootstrapd

View File

@ -6995,10 +6995,18 @@ non_null(1, 2) nullable(3)
static void do_peer_delete(const GC_Session *c, GC_Chat *chat, void *userdata)
{
for (uint32_t i = 1; i < chat->numpeers; ++i) {
const GC_Connection *gconn = get_gc_connection(chat, i);
GC_Connection *gconn = get_gc_connection(chat, i);
assert(gconn != nullptr);
if (gconn->pending_delete) {
if (!gconn->pending_delete) {
continue;
}
if (!gconn->delete_this_iteration) {
gconn->delete_this_iteration = true;
continue;
}
const GC_Exit_Info *exit_info = &gconn->exit_info;
if (exit_info->exit_type == GC_EXIT_TYPE_TIMEOUT && gconn->confirmed) {
@ -7014,7 +7022,6 @@ static void do_peer_delete(const GC_Session *c, GC_Chat *chat, void *userdata)
}
}
}
}
/** @brief Constructs and sends a ping packet to `gconn` containing info needed for group syncing
* and connection maintenance.

View File

@ -133,6 +133,7 @@ typedef struct GC_Connection {
bool pending_key_rotation_request;
bool pending_delete; /* true if this peer has been marked for deletion */
bool delete_this_iteration; /* true if this peer should be deleted this do_gc() iteration*/
GC_Exit_Info exit_info;
} GC_Connection;