- /* *INDENT-OFF* */
- DHCP_INFO ("timeout");
- pool_foreach (c, dcm->clients,
- ({
- timeout = dhcp_client_sm (now, timeout,
- (uword) (c - dcm->clients));
- }));
- /* *INDENT-ON* */
- if (pool_elts (dcm->clients) == 0)
- timeout = 100.0;
+ if (pool_elts (dcm->clients))
+ {
+ /* *INDENT-OFF* */
+ next_expire_time = 1e70;
+ pool_foreach (c, dcm->clients,
+ ({
+ this_next_expire_time = dhcp_client_sm
+ (now, timeout, (uword) (c - dcm->clients));
+ next_expire_time = this_next_expire_time < next_expire_time ?
+ this_next_expire_time : next_expire_time;
+ }));
+ if (next_expire_time > now)
+ timeout = next_expire_time - now;
+ else
+ {
+ clib_warning ("BUG");
+ timeout = 1.13;
+ }
+ /* *INDENT-ON* */
+ }
+ else
+ timeout = 1000.0;