Move total into stats.
This commit is contained in:
parent
64fbe3ec9c
commit
f08812fba4
@ -23,7 +23,6 @@
|
|||||||
void print_help() {
|
void print_help() {
|
||||||
puts("Use `/' at the beginning to indicate a command (like in IRC).");
|
puts("Use `/' at the beginning to indicate a command (like in IRC).");
|
||||||
puts(" stats -- Give network statistics of the local node.");
|
puts(" stats -- Give network statistics of the local node.");
|
||||||
puts(" num_nodes -- Get total number of nodes.");
|
|
||||||
puts(" exit | quit -- Close the program.");
|
puts(" exit | quit -- Close the program.");
|
||||||
puts(" help -- Show this help information.");
|
puts(" help -- Show this help information.");
|
||||||
}
|
}
|
||||||
@ -63,14 +62,13 @@ int main(int argc, char *argv[]) {
|
|||||||
else if(strcmp(in, "/stats") == 0)
|
else if(strcmp(in, "/stats") == 0)
|
||||||
{
|
{
|
||||||
struct stats statistics = NeoComm_get_node_stats();
|
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.good,
|
||||||
statistics.dubious,
|
statistics.dubious,
|
||||||
statistics.cached,
|
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)
|
else if(strcmp(in, "/help") == 0)
|
||||||
print_help();
|
print_help();
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,8 @@ struct stats {
|
|||||||
unsigned int good,
|
unsigned int good,
|
||||||
dubious,
|
dubious,
|
||||||
cached,
|
cached,
|
||||||
incoming;
|
incoming,
|
||||||
|
total;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,13 +123,6 @@ int NeoComm_export_nodes(const char *node_file);
|
|||||||
*/
|
*/
|
||||||
struct stats NeoComm_get_node_stats();
|
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.
|
* @brief Join a channel.
|
||||||
*
|
*
|
||||||
|
@ -113,13 +113,9 @@ int NeoComm_export_nodes(const char *node_file) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int NeoComm_count_connected_nodes() {
|
|
||||||
return node.getNodesStats(AF_UNSPEC).getKnownNodes();
|
|
||||||
}
|
|
||||||
|
|
||||||
struct stats NeoComm_get_node_stats() {
|
struct stats NeoComm_get_node_stats() {
|
||||||
struct stats statistics;
|
struct stats statistics;
|
||||||
node.getNodesStats(
|
statistics.total = node.getNodesStats(
|
||||||
AF_UNSPEC,
|
AF_UNSPEC,
|
||||||
&statistics.good,
|
&statistics.good,
|
||||||
&statistics.dubious,
|
&statistics.dubious,
|
||||||
|
Loading…
Reference in New Issue
Block a user