diff --git a/demo/main.c b/demo/main.c index 165320b..0603a9d 100644 --- a/demo/main.c +++ b/demo/main.c @@ -23,7 +23,6 @@ void print_help() { puts("Use `/' at the beginning to indicate a command (like in IRC)."); puts(" stats -- Give network statistics of the local node."); - puts(" num_nodes -- Get total number of nodes."); puts(" exit | quit -- Close the program."); puts(" help -- Show this help information."); } @@ -63,14 +62,13 @@ int main(int argc, char *argv[]) { else if(strcmp(in, "/stats") == 0) { struct stats statistics = NeoComm_get_node_stats(); - printf("Good: %u\nDubious: %u\nCached: %u\nIncoming: %u\n", + printf("Good: %u\nDubious: %u\nCached: %u\nIncoming: %u\nTotal: %u\n", statistics.good, statistics.dubious, statistics.cached, - statistics.incoming); + statistics.incoming, + statistics.total); } - else if(strcmp(in, "/num_nodes") == 0) - printf("%u", NeoComm_count_connected_nodes()); else if(strcmp(in, "/help") == 0) print_help(); } diff --git a/include/neocomm.h b/include/neocomm.h index 4af3dde..a8928a2 100644 --- a/include/neocomm.h +++ b/include/neocomm.h @@ -56,7 +56,8 @@ struct stats { unsigned int good, dubious, cached, - incoming; + incoming, + total; }; /** @@ -122,13 +123,6 @@ int NeoComm_export_nodes(const char *node_file); */ struct stats NeoComm_get_node_stats(); -/** - * @brief Get the number of nodes connected. - * - * @return A number of the known nodes. - */ -unsigned int NeoComm_count_connected_nodes(); - /** * @brief Join a channel. * diff --git a/src/node.cpp b/src/node.cpp index 9862127..77143cd 100644 --- a/src/node.cpp +++ b/src/node.cpp @@ -113,13 +113,9 @@ int NeoComm_export_nodes(const char *node_file) { return 1; } -unsigned int NeoComm_count_connected_nodes() { - return node.getNodesStats(AF_UNSPEC).getKnownNodes(); -} - struct stats NeoComm_get_node_stats() { struct stats statistics; - node.getNodesStats( + statistics.total = node.getNodesStats( AF_UNSPEC, &statistics.good, &statistics.dubious,