diff options
Diffstat (limited to 'src/lib/frct.c')
-rw-r--r-- | src/lib/frct.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/lib/frct.c b/src/lib/frct.c index c2dfbf6b..c6fef35c 100644 --- a/src/lib/frct.c +++ b/src/lib/frct.c @@ -1,5 +1,5 @@ /* - * Ouroboros - Copyright (C) 2016 - 2022 + * Ouroboros - Copyright (C) 2016 - 2024 * * Flow and Retransmission Control * @@ -20,6 +20,8 @@ * Foundation, Inc., http://www.fsf.org/about/contact/. */ +#include <ouroboros/endian.h> + #define DELT_RDV (100 * MILLION) /* ns */ #define MAX_RDV (1 * BILLION) /* ns */ @@ -259,7 +261,7 @@ static void __send_frct_pkt(int fd, f = &ai.flows[fd]; - if (f->qs.cypher_s > 0 && crypt_encrypt(f, sdb) < 0) + if (crypt_encrypt(&f->crypt, sdb) < 0) goto fail; #ifdef RXM_BLOCKING @@ -269,7 +271,7 @@ static void __send_frct_pkt(int fd, #endif goto fail; - shm_flow_set_notify(f->set, f->flow_id, FLOW_PKT); + shm_flow_set_notify(f->set, f->info.id, FLOW_PKT); return; @@ -396,7 +398,7 @@ static struct frcti * frcti_create(int fd, frcti->n_out = 0; frcti->n_rqo = 0; #endif - if (ai.flows[fd].qs.loss == 0) { + if (ai.flows[fd].info.qs.loss == 0) { frcti->snd_cr.cflags |= FRCTFRTX | FRCTFLINGER; frcti->rcv_cr.cflags |= FRCTFRTX; } @@ -569,12 +571,7 @@ static int __frcti_window_wait(struct frcti * frcti, pthread_cleanup_push(__cleanup_mutex_unlock, &frcti->mtx); - if (abstime != NULL) - ret = -pthread_cond_timedwait(&frcti->cond, - &frcti->mtx, - abstime); - else - ret = -pthread_cond_wait(&frcti->cond, &frcti->mtx); + ret = -__timedwait(&frcti->cond, &frcti->mtx, abstime); pthread_cleanup_pop(false); @@ -789,8 +786,8 @@ static void rtt_estimator(struct frcti * frcti, #ifdef PROC_FLOW_STATS frcti->n_rtt++; #endif - frcti->srtt = MAX(1000U, srtt); - frcti->mdev = MAX(100U, rttvar); + frcti->srtt = MAX(1000L, srtt); + frcti->mdev = MAX(100L, rttvar); frcti->rto = MAX(RTO_MIN, frcti->srtt + (frcti->mdev << MDEV_MUL)); } @@ -925,15 +922,13 @@ static void __frcti_rcv(struct frcti * frcti, pthread_rwlock_unlock(&frcti->lock); if (fd != -1) - timerwheel_ack(fd, frcti); + timerwheel_delayed_ack(fd, frcti); return; drop_packet: pthread_rwlock_unlock(&frcti->lock); - - send_frct_pkt(frcti); - shm_rdrbuff_remove(ai.rdrb, idx); + send_frct_pkt(frcti); return; } |