stcp: ed25519 pubkey exchange in handshake, fix instance destroy segfault, fix chat_tcp_test

- u_async.c: process immediate_queue BEFORE epoll_wait in uasync_poll
- stcp_link.c: defensive NULL etcp_conn/etcp_link in stcp_link_close
- utun_instance.c: move stcp_server_list_destroy_all to Phase J (before ETCP),
  add deferred drain in both Phase J and L
- stcp.h/c: STCP_HS_ENC_CLIENT 6→38, STCP_HS_ENC_SERVER 7→39,
  exchange ed25519_pubkey in both handshake directions
- etcp_connections.c: copy peer_ed25519 from STCP to ETCP_CONN in
  etcp_link_enter_ready_tcp; guard link->etcp in tcp_link_close_cb
- chat_sync.c: fix lk->conn NULL dereference for TCP links
- test_stcp.c: update stcp_server_create/stcp_client_connect callsites
- tools/chat_tcp_test: change transport udp→tcp
This commit is contained in:
evgeny committed 2026-08-07 00:48:27 +03:00
1 parent a3783b5f55
commit 38c9f229bc
1272 files changed
+968388 -1

No files matched your search

+78
View File
@@ -0,0 +1,78 @@
#!/usr/bin/env python3
"""
Script to replace queue_data patterns with macros in test_ll_queue.c
"""
import re
with open('test_ll_queue.c', 'r') as f:
content = f.read()
# Pattern 1: test_data_t* var = (test_data_t*)queue_data_new(sizeof(test_data_t));
# Replace with: Q_NEW(var);
content = re.sub(
r'test_data_t\* (\w+) = \(test_data_t\*\)queue_data_new\(sizeof\(test_data_t\)\);',
r'Q_NEW(\1);',
content
)
# Pattern 2: test_data_t* var = (test_data_t*)queue_data_new_from_pool(pool);
# Replace with: Q_NEW_POOL(var, pool);
content = re.sub(
r'test_data_t\* (\w+) = \(test_data_t\*\)queue_data_new_from_pool\(([^)]+)\);',
r'Q_NEW_POOL(\1, \2);',
content
)
# Pattern 3: test_data_t* var = (test_data_t*)queue_data_get(q);
# Replace with: Q_GET(q, var);
content = re.sub(
r'test_data_t\* (\w+) = \(test_data_t\*\)queue_data_get\(([^)]+)\);',
r'Q_GET(\2, \1);',
content
)
# Pattern 4: queue_data_put(q, var, var->id)
# Replace with: Q_PUT(q, var)
content = re.sub(
r'queue_data_put\(([^,]+), ([^,]+), \2->id\)',
r'Q_PUT(\1, \2)',
content
)
# Pattern 5: queue_data_put_first(q, var, var->id)
# Replace with: Q_PUT_FIRST(q, var)
content = re.sub(
r'queue_data_put_first\(([^,]+), ([^,]+), \2->id\)',
r'Q_PUT_FIRST(\1, \2)',
content
)
# Pattern 6: queue_data_free(var);
# Replace with: Q_FREE(var);
content = re.sub(
r'queue_data_free\((\w+)\);',
r'Q_FREE(\1);',
content
)
# Pattern 7: test_data_t* var = (test_data_t*)queue_find_data_by_id(q, id);
# Replace with: Q_FIND(q, id, var);
content = re.sub(
r'test_data_t\* (\w+) = \(test_data_t\*\)queue_find_data_by_id\(([^,]+), ([^)]+)\);',
r'Q_FIND(\2, \3, \1);',
content
)
# Pattern 8: queue_remove_data(q, var)
# Replace with: Q_REMOVE(q, var)
content = re.sub(
r'queue_remove_data\(([^,]+), ([^)]+)\)',
r'Q_REMOVE(\1, \2)',
content
)
with open('test_ll_queue.c', 'w') as f:
f.write(content)
print("All patterns replaced successfully!")