diff options
author | Hans Dedecker <hans.dedecker@technicolor.com> | 2014-01-15 14:46:44 +0100 |
---|---|---|
committer | Hans Dedecker <hans.dedecker@technicolor.com> | 2014-01-15 14:46:44 +0100 |
commit | 84cfd09747332071c83de4882daecb9bfb80897b (patch) | |
tree | 4ddcf958cd0f37f6ef4040d5aa4d3fd636527ed8 | |
parent | 4d5d803c929092eb07db5717650224afbde59d55 (diff) |
Don't rearm rs timer if callback is not set
-rw-r--r-- | src/router.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/router.c b/src/router.c index a75b847..dfbcf60 100644 --- a/src/router.c +++ b/src/router.c @@ -451,12 +451,14 @@ static void send_router_advert(struct uloop_timeout *event) odhcpd_send(router_event.uloop.fd, &all_nodes, iov, ARRAY_SIZE(iov), iface); - // Rearm timer - int msecs; - odhcpd_urandom(&msecs, sizeof(msecs)); - msecs = (labs(msecs) % (1000 * (MaxRtrAdvInterval - - MinRtrAdvInterval))) + (MinRtrAdvInterval * 1000); - uloop_timeout_set(&iface->timer_rs, msecs); + // Rearm timer if not shut down + if (event->cb) { + int msecs; + odhcpd_urandom(&msecs, sizeof(msecs)); + msecs = (labs(msecs) % (1000 * (MaxRtrAdvInterval + - MinRtrAdvInterval))) + (MinRtrAdvInterval * 1000); + uloop_timeout_set(&iface->timer_rs, msecs); + } } |