From 6751329ab77f5ca81ddddb0021fc5a6ce151d3db Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 14 Nov 2023 12:38:16 +0100 Subject: [PATCH] lib: cancel reconnect timer on free Signed-off-by: Felix Fietkau --- lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib.c b/lib.c index 7be36bb..c545816 100644 --- a/lib.c +++ b/lib.c @@ -713,7 +713,7 @@ void __udebug_disconnect(struct udebug *ctx, bool reconnect) close(ctx->fd.fd); ctx->fd.fd = -1; ctx->poll_handle = -1; - if (ctx->reconnect.cb) + if (ctx->reconnect.cb && reconnect) uloop_timeout_set(&ctx->reconnect, 1); } @@ -726,6 +726,7 @@ void udebug_free(struct udebug *ctx) ctx->socket_path = NULL; __udebug_disconnect(ctx, false); + uloop_timeout_cancel(&ctx->reconnect); while (!list_empty(&ctx->local_rings)) { buf = list_first_entry(&ctx->local_rings, struct udebug_buf, list); -- 2.30.2