Fix timer leaks in ETCP: cancel retrans_timer, ack_resp_timer, and shaper_timer on connection close
This commit is contained in:
1 parent
a0b02b9812
commit
9c768bfd17
2 files changed
+16
No files matched your search
+10
@@ -164,6 +164,16 @@ void etcp_connection_close(struct ETCP_CONN* etcp) {
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_ETCP, "");
|
||||
if (!etcp) return;
|
||||
|
||||
// Cancel active timers to prevent memory leaks
|
||||
if (etcp->retrans_timer) {
|
||||
uasync_cancel_timeout(etcp->instance->ua, etcp->retrans_timer);
|
||||
etcp->retrans_timer = NULL;
|
||||
}
|
||||
if (etcp->ack_resp_timer) {
|
||||
uasync_cancel_timeout(etcp->instance->ua, etcp->ack_resp_timer);
|
||||
etcp->ack_resp_timer = NULL;
|
||||
}
|
||||
|
||||
routing_del_conn(etcp);
|
||||
|
||||
// Notify BGP about connection closure (send withdraws, remove from senders_list)
|
||||
|
||||
@@ -456,6 +456,12 @@ void etcp_link_close(struct ETCP_LINK* link) {
|
||||
link->init_timer = NULL;
|
||||
}
|
||||
|
||||
// Cancel shaper timer if active
|
||||
if (link->shaper_timer) {
|
||||
uasync_cancel_timeout(link->etcp->instance->ua, link->shaper_timer);
|
||||
link->shaper_timer = NULL;
|
||||
}
|
||||
|
||||
// универсальное удаление из односвязного списка
|
||||
struct ETCP_LINK **pp = &link->etcp->links;
|
||||
while (*pp) {
|
||||
|
||||
Reference in new issue
Block a user