From: Ivan Kruglov Date: Wed, 11 Feb 2026 12:44:00 +0000 (-0800) Subject: report: rearrange handling connection drop when skipping metrics X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b465e848f36668f266d024891299bfde80345a30;p=thirdparty%2Fsystemd.git report: rearrange handling connection drop when skipping metrics --- diff --git a/src/report/report.c b/src/report/report.c index 6909f78455c..0eaa898514f 100644 --- a/src/report/report.c +++ b/src/report/report.c @@ -85,15 +85,22 @@ static int metrics_on_query_reply( log_info("Varlink timed out"); else log_error("Varlink error: %s", error_id); - } else if (context->n_metrics >= METRICS_MAX) + + goto finish; + } + + if (context->n_metrics >= METRICS_MAX) { context->n_skipped_metrics++; - else { - /* Collect metrics for later sorting */ - if (!GREEDY_REALLOC(context->metrics, context->n_metrics + 1)) - return log_oom(); - context->metrics[context->n_metrics++] = sd_json_variant_ref(parameters); + goto finish; } + /* Collect metrics for later sorting */ + if (!GREEDY_REALLOC(context->metrics, context->n_metrics + 1)) + return log_oom(); + + context->metrics[context->n_metrics++] = sd_json_variant_ref(parameters); + +finish: if (!FLAGS_SET(flags, SD_VARLINK_REPLY_CONTINUES)) { assert_se(set_remove(context->links, link) == link); link = sd_varlink_close_unref(link);