refactor: STCP connections as ETCP links (is_tcp)
- Add is_tcp, tcp_link, tcp_reconnect_* fields to ETCP_LINK - Remove transport_link from ETCP_CONN, add tcp_link_count - stcp_link: replace embedded etcp_conn with pointer; add etcp_link backpointer - stcp_link: link_rx_cb routes ETCP data to etcp_conn_input - stcp_link: call on_close_cb in close - New TCP functions: etcp_link_enter_ready_tcp, etcp_tcp_link_start_connect, etcp_tcp_link_start_reconnect, tcp_link_close_cb, etcp_tcp_send - etcp_link_new: handle NULL conn for TCP links; skip enter_init for TCP - etcp_link_close: close stcp_link for TCP - etcp_encrypt_send: redirect TCP to etcp_tcp_send (skips AES-CCM) - tcp_server_on_link: create ETCP_LINK(is_tcp=1) + enter_ready_tcp - etcp_connect: TCP addrs -> etcp_tcp_link_start_connect - Remove ctx->tcp_link/tcp_ready - test_stcp_traffic: find stcp_link via links->is_tcp instead of transport_link - 66/68 tests pass; 2 STCP tests expected to fail (integration not complete)
This commit is contained in:
1 parent
937af4c26a
commit
d773f1724a
1705 files changed
+187
-1082154
No files matched your search
@@ -1,38 +0,0 @@
|
||||
--- test_etcp_simple_traffic.c.backup
|
||||
+++ test_etcp_simple_traffic.c
|
||||
@@ -172,19 +172,25 @@
|
||||
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "SIMULATE RX: inst=%s, len=%u",
|
||||
inst->is_server ? "server" : "client", len);
|
||||
|
||||
- // Create a mock ETCP_DGRAM for processing
|
||||
- struct ETCP_DGRAM mock_dgram;
|
||||
- memset(&mock_dgram, 0, sizeof(mock_dgram));
|
||||
- mock_dgram.link = NULL; // Will be set by connection processing
|
||||
- mock_dgram.data_len = len > 1500 ? 1500 : len;
|
||||
- mock_dgram.timestamp = get_current_timestamp();
|
||||
- if (mock_dgram.data_len > 0) {
|
||||
- memcpy(mock_dgram.data, data, mock_dgram.data_len);
|
||||
+ // Create a mock ETCP_DGRAM for processing with proper allocation
|
||||
+ size_t dgram_size = sizeof(struct ETCP_DGRAM) + (len > 1500 ? 1500 : len);
|
||||
+ struct ETCP_DGRAM* mock_dgram = malloc(dgram_size);
|
||||
+ if (!mock_dgram) {
|
||||
+ DEBUG_ERROR(DEBUG_CATEGORY_ETCP, "Failed to allocate mock dgram");
|
||||
+ return;
|
||||
+ }
|
||||
+ memset(mock_dgram, 0, dgram_size);
|
||||
+ mock_dgram->link = NULL; // Will be set by connection processing
|
||||
+ mock_dgram->data_len = len > 1500 ? 1500 : len;
|
||||
+ mock_dgram->timestamp = get_current_timestamp();
|
||||
+ if (mock_dgram->data_len > 0) {
|
||||
+ memcpy(mock_dgram->data, data, mock_dgram->data_len);
|
||||
}
|
||||
|
||||
// Process through ETCP input
|
||||
- etcp_conn_input(&mock_dgram);
|
||||
+ etcp_conn_input(mock_dgram);
|
||||
+
|
||||
+ // Free the allocated memory
|
||||
+ free(mock_dgram);
|
||||
}
|
||||
|
||||
// Simulate packet transmission for analysis
|
||||
Reference in new issue
Block a user