mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:35:06 -05:00
clientlog: save time of last hit with sub-second resolution
Instead of time_t use a 32-bit fixed point representation with 4-bit fraction to save the time of the last hit. The rate can now be measured up to 16 packets per second. Maximum interval between hits is about 4 years.
This commit is contained in:
4
cmdmon.c
4
cmdmon.c
@@ -1043,7 +1043,7 @@ handle_client_accesses_by_index(CMD_Request *rx_message, CMD_Reply *tx_message)
|
||||
sizeof (tx_message->data.client_accesses_by_index.clients));
|
||||
|
||||
for (i = req_first_index, j = 0; i < (uint32_t)n_indices && j < req_n_clients; i++) {
|
||||
if (!CLG_GetClientAccessReportByIndex(i, &report, now.tv_sec))
|
||||
if (!CLG_GetClientAccessReportByIndex(i, &report, &now))
|
||||
continue;
|
||||
|
||||
client = &tx_message->data.client_accesses_by_index.clients[j++];
|
||||
@@ -1290,7 +1290,7 @@ read_from_cmd_socket(void *anything)
|
||||
|
||||
/* OK, we have a valid message. Now dispatch on message type and process it. */
|
||||
|
||||
log_index = CLG_LogCommandAccess(&remote_ip, cooked_now.tv_sec);
|
||||
log_index = CLG_LogCommandAccess(&remote_ip, &cooked_now);
|
||||
|
||||
/* Don't reply to all requests from hosts other than localhost if the rate
|
||||
is excessive */
|
||||
|
||||
Reference in New Issue
Block a user