]> git.scottworley.com Git - tattlekey/blobdiff - client/sends.c
client: Start moving pending-sends logic out to sends.c
[tattlekey] / client / sends.c
diff --git a/client/sends.c b/client/sends.c
new file mode 100644 (file)
index 0000000..c060792
--- /dev/null
@@ -0,0 +1,11 @@
+#include "sends.h"
+
+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) {
+  send_t *sends = (send_t *)user_data;
+  return next_send(&sends[a]) < next_send(&sends[b]);
+}