From: Felix Fietkau Date: Tue, 14 Nov 2023 11:38:16 +0000 (+0100) Subject: lib: cancel reconnect timer on free X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=6751329ab77f5ca81ddddb0021fc5a6ce151d3db;p=project%2Fudebug.git lib: cancel reconnect timer on free Signed-off-by: Felix Fietkau --- 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);