From ffa809b3797e1e8fba4c1c495c4990cae44477d7 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Tue, 16 Jul 2013 19:45:20 -0400 Subject: ncurses test now tells you when you connect to the DHT. --- core/DHT.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'core/DHT.c') diff --git a/core/DHT.c b/core/DHT.c index 18f2de38..399d491b 100644 --- a/core/DHT.c +++ b/core/DHT.c @@ -1017,3 +1017,19 @@ int DHT_load(uint8_t * data, uint32_t size) } return 0; } + +//returns 0 if we are not connected to the DHT +//returns 1 if we are +int DHT_isconnected() +{ + uint32_t i; + uint32_t temp_time = unix_time(); + for(i = 0; i < LCLIENT_LIST; i++) + { + if(close_clientlist[i].timestamp + BAD_NODE_TIMEOUT > temp_time) + { + return 1; + } + } + return 0; +} \ No newline at end of file -- cgit v1.2.3