From d3f3ee16d8adaef681afed67f236e3bb14e7cdc0 Mon Sep 17 00:00:00 2001 From: Joel Grunbaum <joelgrun@gmail.com> Date: Wed, 21 Oct 2020 13:05:26 +0000 Subject: [PATCH] change artifact name and added penalty for failed connections --- main.c | 22 ++++++---------------- 1 files changed, 6 insertions(+), 16 deletions(-) diff --git a/main.c b/main.c index 2f86224..5fb4cf2 100644 --- a/main.c +++ b/main.c @@ -16,19 +16,6 @@ #define NUM_TESTS 10 -/* struct test_server_input { */ -/* int dns; */ -/* //struct hosts_list *hosts; */ -/* int num_hosts; */ -/* int num_tests; */ -/* }; */ - -/* struct progress_input { */ -/* int num_hosts; */ -/* int num_tests; */ -/* int num_servers; */ -/* }; */ - int test_dns(void); void *test_server(void *in); void *print_progress(void *in); @@ -117,10 +104,13 @@ struct hosts_list *curr = hosts; while (curr) { struct timespec run; + run.tv_sec = -1; run.tv_nsec = 0; unsigned char buf[65536]; - run = resolve(buf, curr->server, dns->server, T_A); - if (run.tv_sec == -1) //currently ignore failed tests, need to figure out what to do with them - continue; + for (int i = 0; i < 3 && run.tv_sec == -1; i++) { + run = resolve(buf, curr->server, dns->server, T_A); + } + if (run.tv_sec == -1) //if test has failed 3 times, set time taken to 3s as penalty + run.tv_sec = 3; dns->time.tv_sec += run.tv_sec; dns->time.tv_nsec += run.tv_nsec; if (dns->time.tv_nsec >= 1000000000) { //nanoseconds have overflowed into seconds -- Gitblit v1.10.0