summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2021-12-22 12:14:21 +0100
committerSander Vrijders <sander@ouroboros.rocks>2021-12-22 16:37:41 +0100
commit0a0c244b9939059b86d304dd127763fed7d10af4 (patch)
tree7eb895ce2c8ca7d22bef688e877bc6cfa180d517 /src/lib
parent12f8f9e5ac624f120b21923c89b5aa144a70966a (diff)
downloadouroboros-408e1ab851f5b995b13d7914b5bc74aad8acacb4.tar.gz
ouroboros-408e1ab851f5b995b13d7914b5bc74aad8acacb4.zip
lib: Ease lock in timerwheel0.18.4
It was taking a write lock when a read lock was sufficient. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/timerwheel.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/timerwheel.c b/src/lib/timerwheel.c
index 3c1a44b4..487dcd0e 100644
--- a/src/lib/timerwheel.c
+++ b/src/lib/timerwheel.c
@@ -189,7 +189,7 @@ static void timerwheel_move(void)
|| f->flow_id != r->flow_id)
goto cleanup;
- pthread_rwlock_wrlock(&r->frcti->lock);
+ pthread_rwlock_rdlock(&r->frcti->lock);
snd_lwe = snd_cr->lwe;
rcv_lwe = rcv_cr->lwe;
@@ -198,7 +198,7 @@ static void timerwheel_move(void)
pthread_rwlock_unlock(&r->frcti->lock);
/* Has been ack'd, remove. */
- if ((int) (r->seqno - snd_lwe) < 0)
+ if (before(r->seqno, snd_lwe))
goto cleanup;
/* Check for r-timer expiry. */