From a4dad02064367b1eeb15f6b7aff6fe1a9bf394d5 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Mon, 29 Jun 2015 21:24:16 +0100 Subject: [PATCH] [470246] Change sys tree print output on USR2. Thanks to Yun Wu. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=470246 --- ChangeLog.txt | 2 ++ src/subs.c | 32 +++++++++++++++++--------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index e55cf33c..b4231dfa 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -20,6 +20,8 @@ Broker: - Add systemd startup notification and services. Closes #471053. - Reduce unnecessary malloc and memcpy when receiving a message and storing it. Closes #470258. +- Change sys tree printing output. This format shouldn't be relied upon and + may change at any time. Closes #470246. Client library: - Outgoing messages with QoS>1 are no longer retried after a timeout period. diff --git a/src/subs.c b/src/subs.c index 38dacbb3..0fee527b 100644 --- a/src/subs.c +++ b/src/subs.c @@ -599,23 +599,25 @@ void sub__tree_print(struct mosquitto__subhier *root, int level) struct mosquitto__subhier *branch; struct mosquitto__subleaf *leaf; - for(i=0; isubs; - while(leaf){ - if(leaf->context){ - printf(" (%s, %d)", leaf->context->id, leaf->qos); - }else{ - printf(" (%s, %d)", "", leaf->qos); + if(level > 1){ + for(i=0; i<(level-2)*2; i++){ + printf(" "); } - leaf = leaf->next; - } - if(root->retained){ - printf(" (r)"); + printf("%s", UHPA_ACCESS_TOPIC(root)); + leaf = root->subs; + while(leaf){ + if(leaf->context){ + printf(" (%s, %d)", leaf->context->id, leaf->qos); + }else{ + printf(" (%s, %d)", "", leaf->qos); + } + leaf = leaf->next; + } + if(root->retained){ + printf(" (r)"); + } + printf("\n"); } - printf("\n"); branch = root->children; while(branch){