fix: proxy ERROR loop, BBR test backpressure, O(1) u_free, test ordering
- tcp_proxy: ERROR silently dropped (no ERROR->ERROR loop), Russian removed from logs - etcp_bbr: swap min(lo) and max(4*mss) in bbr_bound_cwnd_for_inflight_model - test_etcp_bbr: fix cwnd comparison (packets vs bytes) - ll_queue: double-put detection (abort), Floyd cycle detection in consistency check - ll_queue: QUEUE_DEBUG commented out (was always-on, O(N) per put) - mem: u_free_impl now O(1) via doubly-linked list, double-free detection - bbr_integration: queue_waiter_wait + call_soon backpressure (threshold=1) - tests/Makefile.am: fast tests first, *.log cleanup before run
This commit is contained in:
1 parent
7f5325ac24
commit
331d43c6f7
10 files changed
+128
-77
No files matched your search
+1
-1
@@ -779,8 +779,8 @@ static void bbr_bound_cwnd_for_inflight_model(struct bbr* bbr, uint32_t* cwnd, u
|
||||
(bbr->mode == BBR_PROBE_BW && bbr->cycle_idx == BBR_BW_PROBE_CRUISE))
|
||||
cap = bbr_inflight_with_headroom(bbr);
|
||||
|
||||
cap = (uint32_t)(cap < bbr->inflight_lo ? cap : bbr->inflight_lo);
|
||||
cap = (uint32_t)(cap > BBR_CWND_MIN_TARGET * mss ? cap : BBR_CWND_MIN_TARGET * mss);
|
||||
cap = (uint32_t)(cap < bbr->inflight_lo ? cap : bbr->inflight_lo);
|
||||
*cwnd = (uint32_t)(cap < *cwnd ? cap : *cwnd);
|
||||
}
|
||||
|
||||
|
||||
@@ -427,7 +427,7 @@ static struct tcp_proxy_client_conn* tcp_proxy_client_find_conn(struct tcp_proxy
|
||||
static void tcp_proxy_client_handle_data(struct tcp_proxy_client* p, struct ETCP_CONN* conn, uint32_t stream_id, struct ll_entry* entry) {
|
||||
struct tcp_proxy_client_conn* pc = tcp_proxy_client_find_conn(p, stream_id);
|
||||
if (!pc || pc->rem_closed || pc->error || pc->tun_closed) {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_SOCKET, "PROXY DATA sid=%08x — no conn/closed, шлём ERROR", stream_id);
|
||||
DEBUG_WARN(DEBUG_CATEGORY_SOCKET, "PROXY DATA sid=%08x — no conn/closed, sending ERROR", stream_id);
|
||||
tcp_proxy_client_send_msg(p->inst, p->via_node_id, TCP_PROXY_SUBCMD_ERROR, stream_id, NULL, 0);
|
||||
queue_dgram_free(entry); queue_entry_free(entry); return;
|
||||
}
|
||||
@@ -448,7 +448,7 @@ static void tcp_proxy_client_handle_close(struct tcp_proxy_client* p, uint32_t s
|
||||
stream_id, pc->tun_closed);
|
||||
pc->rem_closed = 1;
|
||||
} else {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_SOCKET, "PROXY CLOSE sid=%08x — no conn, шлём ERROR", stream_id);
|
||||
DEBUG_WARN(DEBUG_CATEGORY_SOCKET, "PROXY CLOSE sid=%08x — no conn, sending ERROR", stream_id);
|
||||
tcp_proxy_client_send_msg(p->inst, p->via_node_id, TCP_PROXY_SUBCMD_ERROR, stream_id, NULL, 0);
|
||||
}
|
||||
}
|
||||
@@ -460,8 +460,7 @@ static void tcp_proxy_client_handle_error(struct tcp_proxy_client* p, uint32_t s
|
||||
stream_id, pc->tun_closed, pc->rem_closed);
|
||||
pc->error = 1;
|
||||
} else {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_SOCKET, "PROXY ERROR sid=%08x — no conn, шлём ERROR", stream_id);
|
||||
tcp_proxy_client_send_msg(p->inst, p->via_node_id, TCP_PROXY_SUBCMD_ERROR, stream_id, NULL, 0);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "PROXY ERROR sid=%08x — no conn, silent drop", stream_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,6 +495,10 @@ void tcp_proxy_client_etcp_recv_cb(struct ETCP_CONN* conn, struct ll_entry* entr
|
||||
if (subcmd == TCP_PROXY_SUBCMD_CLOSE) { tcp_proxy_client_handle_close(proxy, stream_id); queue_dgram_free(entry); queue_entry_free(entry); return; }
|
||||
if (subcmd == TCP_PROXY_SUBCMD_ERROR) { tcp_proxy_client_handle_error(proxy, stream_id); queue_dgram_free(entry); queue_entry_free(entry); return; }
|
||||
}
|
||||
if (subcmd == TCP_PROXY_SUBCMD_ERROR) {
|
||||
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "PROXY ERROR sid=%08x — conn not found, silent drop", stream_id);
|
||||
queue_dgram_free(entry); queue_entry_free(entry); return;
|
||||
}
|
||||
DEBUG_WARN(DEBUG_CATEGORY_SOCKET, "TCP proxy client: unhandled subcmd=%02x sid=%08x", subcmd, stream_id);
|
||||
queue_dgram_free(entry); queue_entry_free(entry);
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ static void tcp_proxy_server_sock_read_cb(socket_t sock, void* arg) {
|
||||
if (ret == 0) {
|
||||
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "SOCK:RECV fd=%d sid=%08x len=%zd total=%d", (int)rc->sock, rc->stream_id, n, tcp_proxy_server_conn_total(rc));
|
||||
} else {
|
||||
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "SOCK:PAUSE fd=%d sid=%08x len=%zd — backpressure, пауза", (int)rc->sock, rc->stream_id, n);
|
||||
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "SOCK:PAUSE fd=%d sid=%08x len=%zd — backpressure, paused", (int)rc->sock, rc->stream_id, n);
|
||||
rc->pause_buf = u_malloc(n);
|
||||
if (rc->pause_buf) { memcpy(rc->pause_buf, buf, n); rc->pause_len = n; }
|
||||
else DEBUG_ERROR(DEBUG_CATEGORY_SOCKET, "SOCK:PAUSE malloc(%zd) failed sid=%08x", n, rc->stream_id);
|
||||
@@ -330,7 +330,7 @@ int tcp_proxy_server_handle_data(struct UTUN_INSTANCE* inst, struct ETCP_CONN* c
|
||||
struct tcp_proxy_server* ctx = &inst->tcp_proxy_server;
|
||||
struct tcp_proxy_server_conn* rc = tcp_proxy_server_find_conn(ctx, stream_id);
|
||||
if (!rc || rc->sock == SOCKET_INVALID || rc->error) {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_SOCKET, "TPS handle_data: нет/error conn для sid=%08x, шлём ERROR", stream_id);
|
||||
DEBUG_WARN(DEBUG_CATEGORY_SOCKET, "TPS handle_data: no/error conn for sid=%08x, sending ERROR", stream_id);
|
||||
if (conn) tcp_proxy_server_send_msg(inst, conn->peer_node_id, TCP_PROXY_SUBCMD_ERROR, stream_id, NULL, 0);
|
||||
queue_dgram_free(entry); queue_entry_free(entry); return -1;
|
||||
}
|
||||
@@ -370,7 +370,7 @@ void tcp_proxy_server_handle_close(struct UTUN_INSTANCE* inst, uint32_t stream_i
|
||||
}
|
||||
prev = &rc->next;
|
||||
}
|
||||
DEBUG_WARN(DEBUG_CATEGORY_SOCKET, "TCP proxy server: CLOSE sid=%08x — no conn, шлём ERROR", stream_id);
|
||||
DEBUG_WARN(DEBUG_CATEGORY_SOCKET, "TCP proxy server: CLOSE sid=%08x — no conn, sending ERROR", stream_id);
|
||||
tcp_proxy_server_send_msg(inst, inst->node_id, TCP_PROXY_SUBCMD_ERROR, stream_id, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user