From 60bf092d3e6e68d0af55c78b679310b1687016e8 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 16 Apr 2022 14:36:27 -0700 Subject: fixes #1577 nng_stat_find_socket always returns the same stats node Also this fixes problems with uninitialized socket names, and the socket name stat not being adjusted correctly when set via API. --- src/core/stats.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/core/stats.c') diff --git a/src/core/stats.c b/src/core/stats.c index f9de055e..50f24e29 100644 --- a/src/core/stats.c +++ b/src/core/stats.c @@ -1,5 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. +// Copyright 2022 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a @@ -463,7 +463,7 @@ nng_stat * nng_stat_find_scope(nng_stat *stat, const char *name, int id) { nng_stat *child; - if (stat == NULL) { + if (stat == NULL || stat->s_info->si_type != NNG_STAT_SCOPE) { return (NULL); } if ((stat->s_val.sv_id == id) && @@ -473,7 +473,7 @@ nng_stat_find_scope(nng_stat *stat, const char *name, int id) } NNI_LIST_FOREACH (&stat->s_children, child) { nng_stat *result; - if ((result = nng_stat_find(child, name)) != NULL) { + if ((result = nng_stat_find_scope(child, name, id)) != NULL) { return (result); } } -- cgit v1.2.3-70-g09d2