Browse Source

Fix timer leaks in ETCP: cancel retrans_timer, ack_resp_timer, and shaper_timer on connection close

nodeinfo-routing-update
jeka 2 months ago
parent
commit
9c768bfd17
  1. 10
      src/etcp.c
  2. 6
      src/etcp_connections.c

10
src/etcp.c

@ -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)

6
src/etcp_connections.c

@ -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) {

Loading…
Cancel
Save