From: Scott Worley Date: Mon, 9 Oct 2023 22:17:04 +0000 (-0700) Subject: client: Exponential backoff resend intervals X-Git-Tag: v0.1.0~44 X-Git-Url: http://git.scottworley.com/tattlekey/commitdiff_plain/72ba8a8d6836027eaa12bb23bddf8f72900853ab client: Exponential backoff resend intervals --- diff --git a/client/config.c b/client/config.c index 9bd216d..8a31cf5 100644 --- a/client/config.c +++ b/client/config.c @@ -24,4 +24,3 @@ u32_t config_minimum_seconds_between_button_presses = 1; /* Send each report multiple times. */ uint config_resend_count = 5; -u32_t config_resend_interval_ms = 1000; diff --git a/client/config.h b/client/config.h index 91345f9..744e586 100644 --- a/client/config.h +++ b/client/config.h @@ -27,6 +27,5 @@ extern u32_t config_minimum_seconds_between_button_presses; /* Send each report multiple times. */ extern uint config_resend_count; -extern u32_t config_resend_interval_ms; #endif diff --git a/client/tattlekey.c b/client/tattlekey.c index 9af9b5a..c38de12 100644 --- a/client/tattlekey.c +++ b/client/tattlekey.c @@ -14,7 +14,9 @@ typedef struct { u8_t send_count; } send_t; -uint32_t next_send(send_t *s) { return s->timestamp + s->send_count; } +uint32_t next_send(send_t *s) { + return s->timestamp + (1 << s->send_count) - 1; +} bool next_send_less_than(void *user_data, pheap_node_id_t a, pheap_node_id_t b) {