From eef84a2afd2aa0d21072f6e7ef038fe10dcc245d Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Mon, 6 Nov 2017 21:38:55 +0100 Subject: lib: Refactor FRCT implementation The frct_pci and rq headers are moved from include/ouroboros to src/lib since they are only needed in the library. FRCT is moved to its own source file. FRCT takes the application PDUs, encapsulates and processes them and hands them back. This makes it easier to disable FRCT should the application want to write to a "raw" flow. An FRCT instance is now allocated upon alloc and released upon dealloc. The FRCT data structure is split into a sender and receiver connection record. Setting a new configuration will now be done upon sending the next data PDU, which will flag the DRF for a new run and use that configuration. This avoids some issues should packets arrive out-of-order, and simplifies setting a configuration. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/rq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lib/rq.c') diff --git a/src/lib/rq.c b/src/lib/rq.c index bd0594b5..ba425236 100644 --- a/src/lib/rq.c +++ b/src/lib/rq.c @@ -20,7 +20,7 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ -#include +#include "rq.h" #include @@ -77,11 +77,11 @@ int rq_push(struct rq * rq, return -1; i = ++rq->n_items; - j = i / 2; + j = i >> 1; while (i > 1 && rq->items[j].seqno > seqno) { rq->items[i] = rq->items[j]; i = j; - j = j / 2; + j >>= 1; } rq->items[i].seqno = seqno; @@ -121,7 +121,7 @@ size_t rq_pop(struct rq * rq) i = 1; while (true) { k = i; - j = 2 * i; + j = i << 1; if (j <= rq->n_items && rq->items[j].seqno < rq->items[k].seqno) k = j; -- cgit v1.2.3