diff options
Diffstat (limited to 'plugins/check_ntp.c')
| -rw-r--r-- | plugins/check_ntp.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c index 75efc289..914b40ce 100644 --- a/plugins/check_ntp.c +++ b/plugins/check_ntp.c | |||
| @@ -297,7 +297,7 @@ void setup_request(ntp_message *p){ | |||
| 297 | * this is done by filtering servers based on stratum, dispersion, and | 297 | * this is done by filtering servers based on stratum, dispersion, and |
| 298 | * finally round-trip delay. */ | 298 | * finally round-trip delay. */ |
| 299 | int best_offset_server(const ntp_server_results *slist, int nservers){ | 299 | int best_offset_server(const ntp_server_results *slist, int nservers){ |
| 300 | int i=0, cserver=0, best_server=-1; | 300 | int cserver=0, best_server=-1; |
| 301 | 301 | ||
| 302 | /* for each server */ | 302 | /* for each server */ |
| 303 | for(cserver=0; cserver<nservers; cserver++){ | 303 | for(cserver=0; cserver<nservers; cserver++){ |
| @@ -356,7 +356,7 @@ int best_offset_server(const ntp_server_results *slist, int nservers){ | |||
| 356 | * we have to do it in a way that our lazy macros don't handle currently :( */ | 356 | * we have to do it in a way that our lazy macros don't handle currently :( */ |
| 357 | double offset_request(const char *host, int *status){ | 357 | double offset_request(const char *host, int *status){ |
| 358 | int i=0, j=0, ga_result=0, num_hosts=0, *socklist=NULL, respnum=0; | 358 | int i=0, j=0, ga_result=0, num_hosts=0, *socklist=NULL, respnum=0; |
| 359 | int servers_completed=0, one_written=0, one_read=0, servers_readable=0, best_index=-1; | 359 | int servers_completed=0, one_read=0, servers_readable=0, best_index=-1; |
| 360 | time_t now_time=0, start_ts=0; | 360 | time_t now_time=0, start_ts=0; |
| 361 | ntp_message *req=NULL; | 361 | ntp_message *req=NULL; |
| 362 | double avg_offset=0.; | 362 | double avg_offset=0.; |
| @@ -421,7 +421,6 @@ double offset_request(const char *host, int *status){ | |||
| 421 | * been touched in the past second or so and is still lacking | 421 | * been touched in the past second or so and is still lacking |
| 422 | * some responses. for each of these servers, send a new request, | 422 | * some responses. for each of these servers, send a new request, |
| 423 | * and update the "waiting" timestamp with the current time. */ | 423 | * and update the "waiting" timestamp with the current time. */ |
| 424 | one_written=0; | ||
| 425 | now_time=time(NULL); | 424 | now_time=time(NULL); |
| 426 | 425 | ||
| 427 | for(i=0; i<num_hosts; i++){ | 426 | for(i=0; i<num_hosts; i++){ |
| @@ -431,7 +430,6 @@ double offset_request(const char *host, int *status){ | |||
| 431 | setup_request(&req[i]); | 430 | setup_request(&req[i]); |
| 432 | write(socklist[i], &req[i], sizeof(ntp_message)); | 431 | write(socklist[i], &req[i], sizeof(ntp_message)); |
| 433 | servers[i].waiting=now_time; | 432 | servers[i].waiting=now_time; |
| 434 | one_written=1; | ||
| 435 | break; | 433 | break; |
| 436 | } | 434 | } |
| 437 | } | 435 | } |
| @@ -550,7 +548,7 @@ double jitter_request(const char *host, int *status){ | |||
| 550 | DBG(print_ntp_control_message(&req)); | 548 | DBG(print_ntp_control_message(&req)); |
| 551 | /* Attempt to read the largest size packet possible */ | 549 | /* Attempt to read the largest size packet possible */ |
| 552 | req.count=htons(MAX_CM_SIZE); | 550 | req.count=htons(MAX_CM_SIZE); |
| 553 | DBG(printf("recieving READSTAT response")) | 551 | DBG(printf("receiving READSTAT response")) |
| 554 | read(conn, &req, SIZEOF_NTPCM(req)); | 552 | read(conn, &req, SIZEOF_NTPCM(req)); |
| 555 | DBG(print_ntp_control_message(&req)); | 553 | DBG(print_ntp_control_message(&req)); |
| 556 | /* Each peer identifier is 4 bytes in the data section, which | 554 | /* Each peer identifier is 4 bytes in the data section, which |
| @@ -610,7 +608,7 @@ double jitter_request(const char *host, int *status){ | |||
| 610 | DBG(print_ntp_control_message(&req)); | 608 | DBG(print_ntp_control_message(&req)); |
| 611 | 609 | ||
| 612 | req.count = htons(MAX_CM_SIZE); | 610 | req.count = htons(MAX_CM_SIZE); |
| 613 | DBG(printf("recieving READVAR response...\n")); | 611 | DBG(printf("receiving READVAR response...\n")); |
| 614 | read(conn, &req, SIZEOF_NTPCM(req)); | 612 | read(conn, &req, SIZEOF_NTPCM(req)); |
| 615 | DBG(print_ntp_control_message(&req)); | 613 | DBG(print_ntp_control_message(&req)); |
| 616 | 614 | ||
