summaryrefslogtreecommitdiff
path: root/src/lib/cdap.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-04-01 10:04:59 +0000
committerSander Vrijders <sander.vrijders@ugent.be>2017-04-01 10:04:59 +0000
commitd9f3619d791fef7d79127556304a4aa4f1cda50a (patch)
treeefd58bca3a7c0d2302bbc9c9eaffa1d0dc95ad89 /src/lib/cdap.c
parentd9d3d3010511a1893e5fffdfbc5378db59233a1e (diff)
parentd426058a82137d3186a245b0548a262fbd35761b (diff)
downloadouroboros-d9f3619d791fef7d79127556304a4aa4f1cda50a.tar.gz
ouroboros-d9f3619d791fef7d79127556304a4aa4f1cda50a.zip
Merged in dstaesse/ouroboros/be-fixes (pull request #447)
Be fixes
Diffstat (limited to 'src/lib/cdap.c')
-rw-r--r--src/lib/cdap.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/cdap.c b/src/lib/cdap.c
index 824f2c5d..f0db2419 100644
--- a/src/lib/cdap.c
+++ b/src/lib/cdap.c
@@ -183,8 +183,8 @@ static struct cdap_rcvd * cdap_rcvd_get_by_key(struct cdap * instance,
list_for_each_safe(p, h, &instance->rcvd) {
rcvd = list_entry(p, struct cdap_rcvd, next);
if (rcvd->key == key) {
- pthread_mutex_unlock(&instance->rcvd_lock);
list_del(&rcvd->next);
+ pthread_mutex_unlock(&instance->rcvd_lock);
return rcvd;
}
}
@@ -669,6 +669,7 @@ cdap_key_t * cdap_request_send(struct cdap * instance,
pthread_rwlock_unlock(&instance->flows_lock);
release_id(instance, *key);
release_id(instance, iid);
+ *key = INVALID_CDAP_KEY;
return keys;
}
@@ -678,13 +679,17 @@ cdap_key_t * cdap_request_send(struct cdap * instance,
cdap_sent_del(instance, req);
release_id(instance, *key);
release_id(instance, iid);
+ *key = INVALID_CDAP_KEY;
return keys;
}
if (ret < 0) {
+ pthread_rwlock_unlock(&instance->flows_lock);
cdap_sent_del(instance, req);
release_id(instance, *key);
release_id(instance, iid);
+ *key = INVALID_CDAP_KEY;
+ return keys;
}
++key;
@@ -717,6 +722,7 @@ int cdap_reply_wait(struct cdap * instance,
if (ret < 0) {
cdap_sent_del(instance, r);
release_id(instance, iid);
+ release_id(instance, key);
return ret;
}
@@ -731,6 +737,7 @@ int cdap_reply_wait(struct cdap * instance,
cdap_sent_del(instance, r);
release_id(instance, iid);
+ release_id(instance, key);
return ret;
}
@@ -766,6 +773,8 @@ cdap_key_t cdap_request_wait(struct cdap * instance,
}
}
+ assert(rcv->proc == false);
+
rcv->proc = true;
list_del(&rcv->next);
list_add_tail(&rcv->next, &instance->rcvd);