Release pending bootstrap routes on channel deletion and expiry
This commit is contained in:
1 parent
8dfb9d373f
commit
e88de767ac
2 files changed
+9
-2
No files matched your search
@@ -1185,6 +1185,7 @@ void chat_sync_on_channel_deleted(struct UTUN_INSTANCE* inst, const char* ch_id)
|
||||
while (*link) {
|
||||
struct join_pending* item = *link;
|
||||
if (strcmp(item->ch_id, ch_id)) { link = &item->next; continue; }
|
||||
if (item->route.handle && inst->join_carrier) inst->join_carrier->close(inst->join_carrier->ctx, item->route.handle, 0);
|
||||
*link = item->next; u_free(item);
|
||||
}
|
||||
for (int i = 0; i < cs->pending_inv_in_count; ) {
|
||||
@@ -1535,7 +1536,11 @@ static int cs_pending_add(struct chat_sync* cs, uint64_t node_id, const char* ch
|
||||
struct join_pending** link = &cs->join_pending;
|
||||
while (*link) {
|
||||
struct join_pending* item = *link;
|
||||
if (item->expires <= now) { *link = item->next; u_free(item); continue; }
|
||||
if (item->expires <= now) {
|
||||
if (item->route.handle && cs->inst->join_carrier)
|
||||
cs->inst->join_carrier->close(cs->inst->join_carrier->ctx, item->route.handle, 0);
|
||||
*link = item->next; u_free(item); continue;
|
||||
}
|
||||
if (item->node_id == node_id) {
|
||||
if (item->attempt == attempt && !strcmp(item->ch_id, ch_id)) {
|
||||
if (item->route.handle == route->handle && !memcmp(item->route.public_key, route->public_key, 32)) return 0;
|
||||
|
||||
@@ -186,7 +186,9 @@ static void service_link(struct ble_etcp_link* c) {
|
||||
}
|
||||
if (!c->ready) return;
|
||||
if (c->invitation_only) {
|
||||
if (get_time_us() >= c->deadline + 40000000ULL) { fail(c, "invitation-only connection expired"); return; }
|
||||
if (!ble_join_holds(d->bootstrap, c->id) && get_time_us() >= c->deadline + 40000000ULL) {
|
||||
fail(c, "invitation-only connection expired"); return;
|
||||
}
|
||||
if (enabled(d) && !ble_join_holds(d->bootstrap, c->id) && get_time_us() >= c->admission_retry_us) {
|
||||
c->admission_retry_us = get_time_us() + 1000000ULL;
|
||||
if (topo_groups_peer_key_known(d->instance, c->peer_key)) {
|
||||
|
||||
Reference in new issue
Block a user