summaryrefslogtreecommitdiff
path: root/src/lib/frct.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/frct.c')
-rw-r--r--src/lib/frct.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/frct.c b/src/lib/frct.c
index bcb031c3..296d5b2c 100644
--- a/src/lib/frct.c
+++ b/src/lib/frct.c
@@ -105,7 +105,8 @@ static void frct_fini(void)
timerwheel_destroy(frct.tw);
}
-static struct frcti * frcti_create(int fd)
+static struct frcti * frcti_create(int fd,
+ qoscube_t qc)
{
struct frcti * frcti;
time_t delta_t;
@@ -133,6 +134,9 @@ static struct frcti * frcti_create(int fd)
delta_t = (frcti->mpl + frcti->a + frcti->r) / 1000;
+ if (qc == QOS_CUBE_DATA)
+ frcti->snd_cr.cflags |= FRCTFRTX;
+
frcti->snd_cr.conf = true;
frcti->snd_cr.inact = 3 * delta_t + 1;
frcti->snd_cr.act = now.tv_sec - (frcti->snd_cr.inact + 1);
@@ -317,6 +321,9 @@ static int __frcti_snd(struct frcti * frcti,
pci->seqno = hton32(snd_cr->seqno++);
if (!(snd_cr->cflags & FRCTFRTX))
snd_cr->lwe++;
+ else
+ /* TODO: update on ACK */
+ snd_cr->lwe++;
snd_cr->act = now.tv_sec;
snd_cr->conf = false;
@@ -378,7 +385,7 @@ static int __frcti_rcv(struct frcti * frcti,
if (rcv_cr->cflags & FRCTFRTX) {
size_t pos = seqno & (RQ_SIZE - 1);
- if ((seqno - RQ_SIZE - rcv_cr->lwe) > 0 /* Out of rq. */
+ if ((seqno - rcv_cr->lwe) > RQ_SIZE /* Out of rq. */
|| frcti->rq[pos] != -1) /* Duplicate in rq. */
goto drop_packet;
/* Queue. */