From 78d526da1699bec5dbb8257d71b2d65202f804de Mon Sep 17 00:00:00 2001 From: n07070 Date: Wed, 6 May 2020 13:45:16 +0200 Subject: [PATCH] added option to print peer list --- src/debug.h | 2 +- src/node.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/debug.h b/src/debug.h index 9de638f..b6362ed 100644 --- a/src/debug.h +++ b/src/debug.h @@ -4,7 +4,7 @@ #include "node.h" -#define DEBUG_LEVEL 0 +#define DEBUG_LEVEL 6 void welcome(); diff --git a/src/node.c b/src/node.c index cb72406..7d92480 100644 --- a/src/node.c +++ b/src/node.c @@ -1440,6 +1440,8 @@ int run_node(int sock_fd){ if (strcmp("",input_buffer) == 0){ print_info(">> Printing all messages we know of so far :"); print_data_info(data_list); + } else if (strcmp("p",input_buffer) == 0) { + print_peers(neighbour_list); } else { if (DEBUG_LEVEL > 0) { printf("\x1b[31m[DEBUG]\x1b[0m >> Adding following message to the table : ā€œ%sā€\n", input_buffer ); @@ -1602,6 +1604,8 @@ int bootstrap_node(int * sock_fd, char * root_peer_ip, uint16_t root_peer_port){ our_data->seqno = 1337; our_data->data = NULL; + + freeaddrinfo(res); print_debug(">> Boostraping done."); return 0;