test_etcp_router: fix flaky keepalive timeout under dummynet congestion
Root cause: 80kbps congestion causes 9+ second backpressure during push phase. No packets reach server → keepalive timeout (2s default) fires → ETCP link down → BGP cleanup → etcp_router_conn_restart() - frees send_q (up to 64 = ROUTER_MAX_SEND_Q_PACKETS lost) - sends 9-byte restart notification to service handler (conn=NULL) - resets seq to 0 Fixes: 1. Set keepalive_timeout=60000, keepalive_adaptive=0 in test configs to prevent spurious timeouts during intentional congestion testing 2. Handle 9-byte restart notification in srv_handler: when conn==NULL && len==9 → reset g_expected_seq=0 gracefully
This commit is contained in:
1 parent
7628f77b93
commit
46f5ff7eca
1 file changed
+12
-2
@@ -169,6 +169,8 @@ static void write_configs(void) {
|
||||
"my_public_key=%s\n"
|
||||
"tun_ip=10.99.0.1/24\n"
|
||||
"tun_ifname=tun99\n"
|
||||
"keepalive_timeout=60000\n"
|
||||
"keepalive_adaptive=0\n"
|
||||
"[server: s1]\n"
|
||||
"addr=127.0.0.1:%d\n"
|
||||
"type=public\n"
|
||||
@@ -188,6 +190,8 @@ static void write_configs(void) {
|
||||
"my_public_key=%s\n"
|
||||
"tun_ip=10.99.0.2/24\n"
|
||||
"tun_ifname=tun98\n"
|
||||
"keepalive_timeout=60000\n"
|
||||
"keepalive_adaptive=0\n"
|
||||
"[server: s1]\n"
|
||||
"addr=127.0.0.1:%d\n"
|
||||
"type=public\n"
|
||||
@@ -242,9 +246,15 @@ static int send_one_pkt(uint32_t seq, int data_len) {
|
||||
|
||||
// ======================== Server handler ========================
|
||||
static void srv_handler(struct ETCP_CONN* conn, struct ll_entry* entry) {
|
||||
(void)conn;
|
||||
// Restart notification: conn=NULL, len=9, format [svc_id:1][node_id:8]
|
||||
if (!conn && entry && entry->dgram && entry->len == 9) {
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "srv_handler: restart notification, resetting expected_seq from %u to 0", g_expected_seq);
|
||||
g_expected_seq = 0;
|
||||
queue_dgram_free(entry); queue_entry_free(entry);
|
||||
return;
|
||||
}
|
||||
if (!entry || !entry->dgram || entry->len < 10) {
|
||||
printf("[FAIL] srv_handler: bad entry len=%zu\n", entry ? entry->len : 0);
|
||||
printf("[FAIL] srv_handler: bad entry len=%zu conn=%p\n", entry ? entry->len : 0, (void*)conn);
|
||||
if (entry) { queue_dgram_free(entry); queue_entry_free(entry); }
|
||||
g_fail = 4; g_done = -1;
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user