[riot-notifications] [RIOT-OS/RIOT] dhcpv6_client: refactor to use `event_timeout` for non-sock timeouts (#16668)

Martine Lenders notifications at github.com
Thu Jul 22 21:21:53 CEST 2021


@miri64 commented on this pull request.



> +#if IS_USED(MODULE_EVENT_TIMEOUT_ZTIMER)
+    event_timeout_ztimer_init(timeout, ZTIMER_SEC, event_queue, event);
+    event_timeout_set(timeout, delay_sec);
+#else
+    event_timeout_init(timeout, event_queue, event);
+    /* use xtimer_set64 instead of event_timeout_set to prevent overflows */
+    xtimer_set64(&timeout->timer, ((uint64_t)delay_sec) * US_PER_SEC);
+#endif

> Maybe i would like the use of just msec (one ztimer to rule them all, this could also avoid some jitter but dhcpv6 seems to be tolerant to that) question

Main reason for also using `ZTIMER_SEC` is this line. I really do not want to cap of a potential overflow here. Since this function is used to set the T1 and T2 timeouts (both come over the wire) it is not guaranteed that they will be e.g. `UINT32_MAX - 1`.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16668#pullrequestreview-713154522
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210722/a611f77d/attachment.htm>


More information about the notifications mailing list