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
+4
-3
@@ -152,9 +152,10 @@ void ntp_node_sync_peers(struct UTUN_INSTANCE* inst) {
|
||||
if (!inst || !ntp_time_is_synced(inst)) return;
|
||||
|
||||
int sent = 0;
|
||||
for (struct ETCP_CONN* conn = inst->connections; conn; conn = conn->next) {
|
||||
if (!conn->initialized || !conn->links_up) continue;
|
||||
if (send_time_sync(inst, conn->peer_node_id) == 0) sent++;
|
||||
for (struct ll_entry* entry = inst->connections->head; entry; entry = entry->next) {
|
||||
struct conn_queue_entry* ce = (struct conn_queue_entry*)entry->data;
|
||||
if (!ce->conn->initialized || !ce->conn->links_up) continue;
|
||||
if (send_time_sync(inst, ce->conn->peer_node_id) == 0) sent++;
|
||||
}
|
||||
|
||||
DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "NTP_node: broadcast TIME_SYNC to %d peers", sent);
|
||||
|
||||
Reference in new issue
Block a user