Test incoming ETCP expiry, reconnect, sleep and graceful close

This commit is contained in:
evgeny committed 2026-10-12 01:34:44 +02:00
1 parent f090d697c4
commit 0ba8380db4
3 files changed
+195 -4

No files matched your search

+2 -3
View File
@@ -215,7 +215,6 @@ static int etcp_down_timer_start(struct ETCP_CONN* conn) {
conn->down_timer = uasync_set_timeout(conn->instance->ua, ETCP_DOWN_TIMEOUT_TB, conn, etcp_down_timeout_cb, "etcp_down");
if (!conn->down_timer) {
DEBUG_ERROR(DEBUG_CATEGORY_CONNECTION, "[%s] cannot schedule DOWN timeout", conn->log_name);
etcp_connection_close(conn);
return -1;
}
DEBUG_DEBUG(DEBUG_CATEGORY_CONNECTION, "[%s] DOWN timer started timeout_ms=%d refs=%d",
@@ -317,7 +316,7 @@ struct ETCP_CONN* etcp_connection_create(struct UTUN_INSTANCE* instance, char* n
return NULL;
}
if (etcp_down_timer_start(etcp) < 0) return NULL;
if (etcp_down_timer_start(etcp) < 0) { etcp_connection_close(etcp); return NULL; }
DEBUG_DEBUG(DEBUG_CATEGORY_ETCP, "[%s] connection initialized. ETCP=%p mtu=%d, next_tx_id=%u state=pending",
etcp->log_name, etcp, etcp->mtu, etcp->next_tx_id);
@@ -1113,7 +1112,7 @@ void etcp_on_link_down(struct ETCP_CONN* etcp, struct ETCP_LINK* down_link) {
}
int was_up = etcp->links_up;
etcp->links_up = up;
if (!up) etcp_down_timer_start(etcp);
if (!up && etcp_down_timer_start(etcp) < 0) { etcp_connection_close(etcp); return; }
else etcp_down_timer_cancel(etcp);
if (up == 0 && was_up != 0) {
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "All links fall down");
+1 -1
View File
@@ -2906,7 +2906,7 @@ int init_connections(struct UTUN_INSTANCE* instance) {
}
}
node_conn_direct_init(instance);
if (node_conn_direct_init(instance) < 0) return -1;
etcp_keepalive_register(instance);
// Return 1 if there was a partial socket initialization error