diff options
| author | Garrett D'Amore <garrett@damore.org> | 2022-04-16 14:36:27 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2022-04-16 14:36:27 -0700 |
| commit | 60bf092d3e6e68d0af55c78b679310b1687016e8 (patch) | |
| tree | 9644e6ff61b4f23e4c77b01965fdfb928082b6a2 /src/core/stats.c | |
| parent | ef929a35833fed8eac4aaaf7739d4df1ed72ae00 (diff) | |
| download | nng-60bf092d3e6e68d0af55c78b679310b1687016e8.tar.gz nng-60bf092d3e6e68d0af55c78b679310b1687016e8.tar.bz2 nng-60bf092d3e6e68d0af55c78b679310b1687016e8.zip | |
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.
Diffstat (limited to 'src/core/stats.c')
| -rw-r--r-- | src/core/stats.c | 6 |
1 files changed, 3 insertions, 3 deletions
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. <info@staysail.tech> +// Copyright 2022 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // // 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); } } |
