diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2022-03-28 20:29:03 +0200 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2022-03-30 15:12:25 +0200 |
commit | 64cbe652a72ac81a3d5efc4bb01d25dd52166137 (patch) | |
tree | 9d801d60aafae22d0de4602bdb2fde4217f5a33d | |
parent | efe850f4f90967649cdb27cfa29ca0a17127f932 (diff) | |
download | ouroboros-64cbe652a72ac81a3d5efc4bb01d25dd52166137.tar.gz ouroboros-64cbe652a72ac81a3d5efc4bb01d25dd52166137.zip |
lib: Fix unidirectional FRCT traffic handling
Unidirectional traffic has one of the peers only send bare FRCT
packets. These never set a DRF, since they have no sequence number.
At the receiver, all these ACKs and window updates were always dropped
as the receiver connection record was timed out.
Also fixes a SEGV if flow control kicks in (passing NULL timeout to
pthread_cond_timedwait).
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r-- | src/lib/frct.c | 16 | ||||
-rw-r--r-- | src/lib/timerwheel.c | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/frct.c b/src/lib/frct.c index c9e45ef8..d703aeaa 100644 --- a/src/lib/frct.c +++ b/src/lib/frct.c @@ -294,7 +294,7 @@ static void send_frct_pkt(struct frcti * frcti) diff = ts_diff_ns(&frcti->rcv_cr.act, &now); - if (diff > frcti->a || diff < frcti->mdev) { + if (diff > frcti->a || diff < TICTIME) { pthread_rwlock_unlock(&frcti->lock); return; } @@ -371,7 +371,7 @@ static struct frcti * frcti_create(int fd, frcti->probe = false; frcti->srtt = 0; /* Updated on first ACK */ - frcti->mdev = 10 * MILLION; /* Initial rxm will be after 20 ms */ + frcti->mdev = 10 * MILLION; /* Updated on first ACK */ frcti->rto = BILLION; /* Initial rxm will be after 1 s */ #ifdef PROC_FLOW_STATS frcti->n_rtx = 0; @@ -540,7 +540,6 @@ static int __frcti_window_wait(struct frcti * frcti, while (snd_cr->seqno == snd_cr->rwe && ret != -ETIMEDOUT) { struct timespec now; - pthread_rwlock_unlock(&frcti->lock); pthread_mutex_lock(&frcti->mtx); @@ -554,9 +553,12 @@ static int __frcti_window_wait(struct frcti * frcti, pthread_cleanup_push(__cleanup_mutex_unlock, &frcti->mtx); - ret = -pthread_cond_timedwait(&frcti->cond, - &frcti->mtx, - abstime); + if (abstime != NULL) + ret = -pthread_cond_timedwait(&frcti->cond, + &frcti->mtx, + abstime); + else + ret = -pthread_cond_wait(&frcti->cond, &frcti->mtx); pthread_cleanup_pop(false); @@ -800,7 +802,7 @@ static void __frcti_rcv(struct frcti * frcti, if (pci->flags & FRCT_DRF) { /* New run. */ rcv_cr->lwe = seqno; rcv_cr->rwe = seqno + RQ_SIZE; - } else { + } else if (pci->flags & FRCT_DATA) { goto drop_packet; } } diff --git a/src/lib/timerwheel.c b/src/lib/timerwheel.c index cfdf2c9f..3225bf35 100644 --- a/src/lib/timerwheel.c +++ b/src/lib/timerwheel.c @@ -228,7 +228,6 @@ static void timerwheel_move(void) goto flow_down; rslot = (rslot + slot + 1) & (RXMQ_SLOTS - 1); - #ifdef RXM_BLOCKING if (ipcp_sdb_reserve(&sdb, r->len) < 0) #else @@ -249,7 +248,6 @@ static void timerwheel_move(void) /* Retransmit the copy. */ pci->ackno = hton32(rcv_lwe); - #ifdef RXM_BLOCKING if (shm_rbuff_write_b(f->tx_rb, idx, NULL) < 0) #else |