Mercurial > louis > mq > lightsd
changeset 324:1d6463753197
wipwip
author | Louis Opter <kalessin@kalessin.fr> |
---|---|
date | Sat, 12 Sep 2015 23:53:27 -0700 |
parents | 83460d87fa3a |
children | a728d5ce3a58 |
files | fixup_scheduling.patch series |
diffstat | 2 files changed, 46 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fixup_scheduling.patch Sat Sep 12 23:53:27 2015 -0700 @@ -0,0 +1,45 @@ +# HG changeset patch +# Parent 9d1679be671a1eaca7bdd310c8d514a497de7a92 + +diff --git a/lifx/gateway.c b/lifx/gateway.c +--- a/lifx/gateway.c ++++ b/lifx/gateway.c +@@ -245,6 +245,15 @@ + (void)timer; + struct lgtd_lifx_gateway *gw = ctx.as_ptr; + lgtd_lifx_gateway_send_get_all_light_state(gw); ++ ++ struct timeval tv = LGTD_MSECS_TO_TIMEVAL( ++ LGTD_LIFX_GATEWAY_MIN_REFRESH_INTERVAL_MSECS ++ ); ++ lgtd_timer_reschedule(gw->refresh_timer, &tv); ++ lgtd_debug( ++ "scheduling next GET_LIGHT_STATE on %s in %dms", ++ gw->peeraddr, LGTD_LIFX_GATEWAY_MIN_REFRESH_INTERVAL_MSECS ++ ); + } + + void +@@ -544,15 +553,13 @@ + + lgtd_time_mono_t latency = lgtd_lifx_gateway_latency(gw); + if (latency < LGTD_LIFX_GATEWAY_MIN_REFRESH_INTERVAL_MSECS) { +- if (!lgtd_timer_ispending(gw->refresh_timer)) { +- int timeout = LGTD_LIFX_GATEWAY_MIN_REFRESH_INTERVAL_MSECS - latency; +- struct timeval tv = LGTD_MSECS_TO_TIMEVAL(timeout); +- lgtd_timer_reschedule(gw->refresh_timer, &tv); +- lgtd_debug( +- "%s latency is %jums, scheduling next GET_LIGHT_STATE in %dms", +- gw->peeraddr, (uintmax_t)latency, timeout +- ); +- } ++ int timeout = LGTD_LIFX_GATEWAY_MIN_REFRESH_INTERVAL_MSECS - latency; ++ struct timeval tv = LGTD_MSECS_TO_TIMEVAL(timeout); ++ lgtd_timer_reschedule(gw->refresh_timer, &tv); ++ lgtd_debug( ++ "%s latency is %jums, re-scheduling next GET_LIGHT_STATE in %dms", ++ gw->peeraddr, (uintmax_t)latency, timeout ++ ); + return; + } +
--- a/series Sat Sep 12 23:27:43 2015 -0700 +++ b/series Sat Sep 12 23:53:27 2015 -0700 @@ -7,5 +7,6 @@ import_setproctitle_remove_bsd_dependency.patch add_privdrop_systemd_lanuchd.patch check_if_existing_pipe_is_fifo.patch +fixup_scheduling.patch use_echo_request_reply_to_measure_latency.patch #+future add_ipv4_to_ieee8023mac.patch #+future #+linux