mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 01:20:16 +01:00
platform: clamp timestamp in event_handler_read_netlink()
This commit is contained in:
parent
a79efac2fe
commit
ba9b199cfd
1 changed files with 6 additions and 2 deletions
|
|
@ -9289,8 +9289,12 @@ after_read:
|
|||
nm_assert(next.seq_number);
|
||||
nm_assert(next.now_nsec > 0);
|
||||
nm_assert(next.timeout_abs_nsec > next.now_nsec);
|
||||
nm_assert(next.timeout_abs_nsec - next.now_nsec <= 200 * (NM_UTILS_NSEC_PER_SEC / 1000));
|
||||
|
||||
timeout_msec = (next.timeout_abs_nsec - next.now_nsec) / (NM_UTILS_NSEC_PER_SEC / 1000);
|
||||
timeout_msec =
|
||||
NM_CLAMP((next.timeout_abs_nsec - next.now_nsec) / (NM_UTILS_NSEC_PER_SEC / 1000),
|
||||
1,
|
||||
1000);
|
||||
|
||||
_LOGT("netlink: read: wait for ACK for sequence number %u... (%d msec)",
|
||||
next.seq_number,
|
||||
|
|
@ -9299,7 +9303,7 @@ after_read:
|
|||
memset(&pfd, 0, sizeof(pfd));
|
||||
pfd.fd = nl_socket_get_fd(priv->nlh);
|
||||
pfd.events = POLLIN;
|
||||
r = poll(&pfd, 1, MAX(1, timeout_msec));
|
||||
r = poll(&pfd, 1, timeout_msec);
|
||||
|
||||
if (r == 0) {
|
||||
/* timeout and there is nothing to read. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue