1
This commit is contained in:
1 parent
085c609b36
commit
67b4cd7cb1
2 files changed
+27
-3
No files matched your search
@@ -114,7 +114,7 @@ static void etcp_link_send_init(struct ETCP_LINK* link, uint8_t reset) {
|
||||
static void etcp_link_init_timer_cbk(void* arg) {
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_CONNECTION, "");
|
||||
struct ETCP_LINK* link = (struct ETCP_LINK*)arg;
|
||||
if (!link) return;
|
||||
if (!link || !link->etcp || !link->etcp->instance) return;
|
||||
|
||||
if ((link->init_retry_count % 10) == 0 && link->init_timeout < INIT_TIMEOUT_MAX) {
|
||||
link->init_timeout += link->init_timeout/4 +1;
|
||||
@@ -219,7 +219,7 @@ static void keepalive_timer_cb(void* arg) {
|
||||
if (!link || !link->etcp || !link->etcp->instance) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_CONNECTION, "KEEPALIVE NULL !!!!!!!!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
link->keepalive_timer = NULL;
|
||||
|
||||
@@ -717,7 +717,7 @@ void start_stats_timer(struct ETCP_LINK* link) {
|
||||
// === Новый callback таймера ===
|
||||
static void link_stats_timer_cb(void* arg) {
|
||||
struct ETCP_LINK* link = (struct ETCP_LINK*)arg;
|
||||
if (!link || !link->etcp) return;
|
||||
if (!link || !link->etcp || !link->etcp->instance) return;
|
||||
|
||||
// 1. Сохраняем снимок текущего окна
|
||||
link->stat_win[link->win_ptr].rtt = link->rtt_avg10;
|
||||
|
||||
@@ -248,6 +248,26 @@ static void test_timeout(void* arg) {
|
||||
}
|
||||
}
|
||||
|
||||
static void cleanup_instance_timers(struct UTUN_INSTANCE* instance, struct UASYNC* ua) {
|
||||
if (!instance || !ua) return;
|
||||
struct ETCP_CONN* conn = instance->connections;
|
||||
while (conn) {
|
||||
struct ETCP_LINK* link = conn->links;
|
||||
while (link) {
|
||||
if (link->keepalive_timer) {
|
||||
uasync_cancel_timeout(ua, link->keepalive_timer);
|
||||
link->keepalive_timer = NULL;
|
||||
}
|
||||
if (link->init_timer) {
|
||||
uasync_cancel_timeout(ua, link->init_timer);
|
||||
link->init_timer = NULL;
|
||||
}
|
||||
link = link->next;
|
||||
}
|
||||
conn = conn->next;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
// Create temp config files first
|
||||
if (create_temp_configs() != 0) {
|
||||
@@ -382,6 +402,10 @@ int main() {
|
||||
// uasync_print_resources(ua, "SHARED"); // disabled to prevent potential null deref with TUN disabled
|
||||
}
|
||||
|
||||
// Explicit timer cleanup for all links (without changing library)
|
||||
if (server_instance && ua) cleanup_instance_timers(server_instance, ua);
|
||||
if (client_instance && ua) cleanup_instance_timers(client_instance, ua);
|
||||
|
||||
// Stop and destroy instances (safe for TUN-disabled mode)
|
||||
if (server_instance) {
|
||||
server_instance->running = 0;
|
||||
|
||||
Reference in new issue
Block a user