summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2021-12-22 12:08:37 +0100
committerSander Vrijders <sander@ouroboros.rocks>2021-12-22 16:35:18 +0100
commitb1f19a134d44b3abc0dcb83982e7e0769cf3c105 (patch)
tree717416011cf1c343fb7242abd90f87a4325da9df
parente3970d0a46ede685aaf275a08175d79c830676c6 (diff)
downloadouroboros-b1f19a134d44b3abc0dcb83982e7e0769cf3c105.tar.gz
ouroboros-b1f19a134d44b3abc0dcb83982e7e0769cf3c105.zip
lib: Add missing rwlock unlock in FRCT
There was a missing unlock in FRCT. Also fixes some indentation. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r--src/lib/frct.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/frct.c b/src/lib/frct.c
index 61a3fde0..a1e792af 100644
--- a/src/lib/frct.c
+++ b/src/lib/frct.c
@@ -273,6 +273,7 @@ static void send_frct_pkt(struct frcti * frcti)
frcti->rcv_cr.seqno = frcti->rcv_cr.lwe;
pthread_rwlock_unlock(&frcti->lock);
+
}
static void __send_rdv(int fd)
@@ -463,7 +464,7 @@ static void frcti_setflags(struct frcti * frcti,
static bool __frcti_is_window_open(struct frcti * frcti)
{
struct frct_cr * snd_cr = &frcti->snd_cr;
- int ret = true;
+ bool ret = true;
pthread_rwlock_rdlock(&frcti->lock);
@@ -471,7 +472,7 @@ static bool __frcti_is_window_open(struct frcti * frcti)
ret = before(snd_cr->seqno, snd_cr->rwe);
if (!ret) {
- struct timespec now;
+ struct timespec now;
clock_gettime(PTHREAD_COND_CLOCK, &now);
@@ -485,6 +486,7 @@ static bool __frcti_is_window_open(struct frcti * frcti)
diff = ts_diff_ns(&frcti->t_wnd, &now);
if (diff > MAX_RDV) {
pthread_mutex_unlock(&frcti->mtx);
+ pthread_rwlock_unlock(&frcti->lock);
return false;
}