mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:35:06 -05:00
ntp: wait for late HW TX timestamps
When sending client requests to a close and fast server, it is possible that a response will be received before the HW transmit timestamp of the request itself. To avoid processing of the response without the HW timestamp, monitor events returned by select() and suspend reading of packets from the receive queue for up to 200 microseconds. As the requests are normally separated by at least 200 milliseconds, it is sufficient to monitor and suspend one socket at a time.
This commit is contained in:
8
ntp_io.c
8
ntp_io.c
@@ -318,6 +318,9 @@ close_socket(int sock_fd)
|
||||
if (sock_fd == INVALID_SOCK_FD)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_LINUX_TIMESTAMPING
|
||||
NIO_Linux_NotifySocketClosing(sock_fd);
|
||||
#endif
|
||||
SCH_RemoveFileHandler(sock_fd);
|
||||
close(sock_fd);
|
||||
}
|
||||
@@ -685,6 +688,11 @@ read_from_socket(int sock_fd, int event, void *anything)
|
||||
unsigned int i, n;
|
||||
int status, flags = 0;
|
||||
|
||||
#ifdef HAVE_LINUX_TIMESTAMPING
|
||||
if (NIO_Linux_ProcessEvent(sock_fd, event))
|
||||
return;
|
||||
#endif
|
||||
|
||||
hdr = ARR_GetElements(recv_headers);
|
||||
n = ARR_GetSize(recv_headers);
|
||||
assert(n >= 1);
|
||||
|
||||
Reference in New Issue
Block a user