summaryrefslogtreecommitdiff
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
parent12f8f9e5ac624f120b21923c89b5aa144a70966a (diff)
downloadouroboros-0a0c244b9939059b86d304dd127763fed7d10af4.tar.gz
ouroboros-0a0c244b9939059b86d304dd127763fed7d10af4.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>
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/lib/timerwheel.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6e49074d..27fe03ef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,7 +9,7 @@ include(GNUInstallDirs)
set(PACKAGE_VERSION_MAJOR 0)
set(PACKAGE_VERSION_MINOR 18)
-set(PACKAGE_VERSION_PATCH 3)
+set(PACKAGE_VERSION_PATCH 4)
set(PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
set(PACKAGE_DESCRIPTION "The Ouroboros prototype")
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. */