diff options
| author | Garrett D'Amore <garrett@damore.org> | 2019-01-01 11:29:05 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2019-01-01 11:29:05 -0800 |
| commit | 573cdf8c8aff43c5cda2b3d090c7916bb3507a23 (patch) | |
| tree | 92dd4424fb62a7ef3d0d8d232b0cdc1762769ba0 /src | |
| parent | fa65c83b65c0d5600c64d243b1c14d270a317b74 (diff) | |
| download | nng-573cdf8c8aff43c5cda2b3d090c7916bb3507a23.tar.gz nng-573cdf8c8aff43c5cda2b3d090c7916bb3507a23.tar.bz2 nng-573cdf8c8aff43c5cda2b3d090c7916bb3507a23.zip | |
fixes #841 Calling nng_stats_get() before creating socket panics
While here fixed a spelling error in the description of the global
statistics structure.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/stats.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/stats.c b/src/core/stats.c index ffe6659c..afeafff6 100644 --- a/src/core/stats.c +++ b/src/core/stats.c @@ -336,6 +336,10 @@ int nng_stats_get(nng_stat **statp) { #ifdef NNG_ENABLE_STATS + int rv; + if ((rv = nni_init()) != 0) { + return (rv); + } return (nni_stat_snapshot(statp, &stats_root)); #else NNI_ARG_UNUSED(statp); @@ -413,7 +417,7 @@ nni_stat_sys_init(void) nni_mtx_init(&stats_lock); NNI_LIST_INIT(&stats_root.si_children, nni_stat_item, si_node); stats_root.si_name = ""; - stats_root.si_desc = "all statistsics"; + stats_root.si_desc = "all statistics"; #endif return (0); |
