]> git.scottworley.com Git - tattlekey/commitdiff
client: Exponential backoff resend intervals
authorScott Worley <scottworley@scottworley.com>
Mon, 9 Oct 2023 22:17:04 +0000 (15:17 -0700)
committerScott Worley <scottworley@scottworley.com>
Wed, 11 Oct 2023 01:48:57 +0000 (18:48 -0700)
client/config.c
client/config.h
client/tattlekey.c

index 9bd216dba00dca5639c6e59e56e9391f3c7dbd71..8a31cf5beb04bf0b4a856e611565370cd7babf1d 100644 (file)
@@ -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;
index 91345f9a78ab32e5c376ad2a64f7040c5c552bf7..744e58626dc0b053b51ea74009ac4ab6da63f8a5 100644 (file)
@@ -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
index 9af9b5aef2f12e8e7147035f844af1d8aac557ef..c38de126d50245cd3a9ba08d128e170b6c23d75c 100644 (file)
@@ -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) {