We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f266f8a commit 0b7f8f9Copy full SHA for 0b7f8f9
tools/sdk/lwip/src/core/ipv4/igmp.c
@@ -703,11 +703,22 @@ static void
703
igmp_start_timer(struct igmp_group *group, u8_t max_time)
704
{
705
/* ensure the input value is > 0 */
706
+#ifdef LWIP_RAND
707
if (max_time == 0) {
708
max_time = 1;
709
}
710
/* ensure the random value is > 0 */
- group->timer = (LWIP_RAND() % (max_time - 1)) + 1;
711
+ group->timer = (LWIP_RAND() % max_time);
712
+ if (group->timer == 0) {
713
+ group->timer = 1;
714
+ }
715
+#else /* LWIP_RAND */
716
+ /* ATTENTION: use this only if absolutely necessary! */
717
+ group->timer = max_time / 2;
718
719
720
721
+#endif /* LWIP_RAND */
722
723
724
/**
0 commit comments