static void trees_dump(struct dsync_mailbox_tree *tree1, struct dsync_mailbox_tree *tree2) { printf("tree1:\n"); nodes_dump(tree1->root.first_child, 1); printf("tree2:\n"); nodes_dump(tree2->root.first_child, 1); }
//-------------------------------------------------------------------------------------------------- // When SIGHUP is received, we need to print out detailed statistics to the logfile. This will // include as much information as we can gather quickly. static void sighup_handler(evutil_socket_t fd, short what, void *arg) { assert(arg == NULL); assert(_dump == NULL); assert(_dump_len == 0); assert(_dump_max == 0); stat_dumpstr("System Dump Initiated."); stat_dumpstr("--------------------------------------------------------------"); // dump the list of nodes. nodes_dump(); // dump the list of clients. clients_dump(); // dump the list of buckets. buckets_dump(); stat_dumpstr("--------------------------------------------------------------"); assert(_dump); assert(_dump_len > 0); assert(_dump_len <= _dump_max); logger(LOG_MINIMAL, "%s", _dump); // now that we have logged the data, we can free the dumpstr. free(_dump); _dump = NULL; _dump_len = 0; _dump_max = 0; }
static void nodes_dump(const struct dsync_mailbox_node *node, unsigned int depth) { unsigned int i; for (; node != NULL; node = node->next) { for (i = 0; i < depth; i++) printf(" "); printf("%-*s guid:%.5s uidv:%u %d%d %ld\n", 40-depth, node->name, guid_128_to_string(node->mailbox_guid), node->uid_validity, node->existence, node->subscribed, (long)node->last_renamed_or_created); nodes_dump(node->first_child, depth+1); } }