From e00c9b13acad23e14df9d5cf4c7868dfd6e1bc55 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 8 Feb 2019 10:47:42 +0100 Subject: lib: Add initial rtt estimator to FRCT This adds a simple round-trip time estimator to FRCT. The estimate is a weighted average with deviation. The retransmission is scheduled after rtt + 2 times the deviation. A retransmit doubles the rtt estimate to avoid the no-update case when rtt suddenly increases. The rtt is estimated in microseconds and the granularity for retransmits is 256 microseconds. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- include/ouroboros/utils.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/ouroboros/utils.h b/include/ouroboros/utils.h index f5b6686f..d40a1783 100644 --- a/include/ouroboros/utils.h +++ b/include/ouroboros/utils.h @@ -28,6 +28,7 @@ #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #define MAX(a,b) (((a) > (b)) ? (a) : (b)) +#define ABS(a) ((a) > 0 ? (a) : -(a)) typedef struct { uint8_t * data; -- cgit v1.2.3