etcp: replace connections linked-list with indexed ll_queue, add state/ref_count lifecycle
- Remove ETCP_CONN.next linked-list, UTUN_INSTANCE.connections list/count
- Unified connections in single ll_queue indexed by peer_node_id (0=pending)
- struct conn_queue_entry { peer_node_id, conn* } for uniform queue data
- Connection lifecycle via etcp.c: create→pending, conn_ready→indexed, close→detach+deferred free
- Close split: phase1 detach from external world, phase2 deferred via uasync_call_soon
- etcp_conn_set_peer_node_id: reindex on ID change (WARN)
- etcp_conn_ref_take/free: blocking close until refcount returns to 0
- Remove chat_connections — use unified connections queue directly
- Update all iteration/search patterns across 40 files (src + tests + chatgui)
This commit is contained in:
1 parent
6902f5fd95
commit
a7ecee01f5
40 files changed
+650
-449
No files matched your search
@@ -215,10 +215,15 @@ static char* make_cfg_client(void) {
|
||||
}
|
||||
|
||||
static int conn_ready(struct UTUN_INSTANCE* inst) {
|
||||
if (!inst) return 0;
|
||||
for (struct ETCP_CONN* c = inst->connections; c; c = c->next)
|
||||
if (!inst || !inst->connections) return 0;
|
||||
struct ll_entry* entry = inst->connections->head;
|
||||
while (entry) {
|
||||
struct conn_queue_entry* ce = (struct conn_queue_entry*)entry->data;
|
||||
struct ETCP_CONN* c = ce->conn;
|
||||
for (struct ETCP_LINK* l = c->links; l; l = l->next)
|
||||
if (l->initialized && c->crypto_ctx.initialized) return 1;
|
||||
entry = entry->next;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user