Skip to content

Commit b7e0b8f

Browse files
committed
fixed bugs
1 parent aa43f87 commit b7e0b8f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

include/core/config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
#define APP_VERSION_PATCH 1
3737
#define APP_VERSION_SUFFIX "-dev"
3838

39-
#define BUILD_NUMBER 813
39+
#define BUILD_NUMBER 815
4040

41-
#define APP_VERSION_RELEASE_DATE 1551763412
41+
#define APP_VERSION_RELEASE_DATE 1551809540
4242

4343
#define APP_INIT_DIGEST "FF0000000000000000000000000000FF"
4444

service/ntp.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -416,20 +416,20 @@ ntp_peer_recv (uint8 peer_idx, ntp_peer_t * peer, ntp_packet_t * packet, ntp_tim
416416
d_log_wprintf (NTP_SERVICE_NAME, IPSTR " invalid ntp version: %u", IP2STR (&peer->ipaddr), packet->version);
417417
peer->state = NTP_PEER_STATE_ERROR;
418418
}
419-
else if ((packet->root_delay.seconds == 0 && packet->root_delay.fraction ==0) ||
420-
(packet->root_dispersion.seconds == 0 && packet->root_dispersion.fraction ==0) ||
421-
(packet->reference_ts.seconds == 0)) {
422-
d_log_wprintf (NTP_SERVICE_NAME, IPSTR " incorrect response", IP2STR (&peer->ipaddr));
423-
peer->state = NTP_PEER_STATE_ERROR;
424-
}
425419
else {
426420
// calculate RTT median and variance
427421
sint64_t _x = ntp_time_diff_usec (recv_ts, &packet->origin_ts);
428422
sint64_t _y = ntp_time_diff_usec (&packet->transmit_ts, &packet->receive_ts);
429423
//os_printf("-- origin=%d, recv=%d:%d, trans=%d:%d, recv2=%d\n", packet->origin_ts.seconds, packet->receive_ts.seconds, packet->receive_ts.fraction,
430424
// packet->transmit_ts.seconds, packet->transmit_ts.fraction, recv_ts->seconds);
431425

432-
if ((_x > 0) || (_y > 0) || (_x > _y)) { // wrong times
426+
if ((packet->root_delay.seconds == 0 && packet->root_delay.fraction ==0) ||
427+
(packet->root_dispersion.seconds == 0 && packet->root_dispersion.fraction ==0) ||
428+
(packet->reference_ts.seconds == 0))
429+
{
430+
// wrong response
431+
}
432+
else if ((_x > 0) || (_y > 0) || (_x > _y)) { // wrong times
433433
os_memcpy (&peer->peer_ts, &packet->transmit_ts, sizeof (ntp_timestamp_t));
434434
os_memcpy (&peer->local_ts, recv_ts, sizeof (ntp_timestamp_t));
435435

0 commit comments

Comments
 (0)