diff options
author | dimitri staessens <dimitri.staessens@ugent.be> | 2017-03-31 15:58:12 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@ugent.be> | 2017-03-31 16:01:47 +0200 |
commit | b47ca8de07c11bfddf3e8ecb2fd227049c512b9a (patch) | |
tree | 9623d6a0e94f327151a537485110442809dda9ca | |
parent | e39e93447d8da3bf06b8f5aecd3daf41c0451f81 (diff) | |
download | ouroboros-b47ca8de07c11bfddf3e8ecb2fd227049c512b9a.tar.gz ouroboros-b47ca8de07c11bfddf3e8ecb2fd227049c512b9a.zip |
irmd: Keep track of qos in irm_flow
This fixes the bug in handling multiple concurrent flow allocations.
-rw-r--r-- | src/ipcpd/normal/pol/complete.c | 2 | ||||
-rw-r--r-- | src/irmd/irm_flow.c | 8 | ||||
-rw-r--r-- | src/irmd/irm_flow.h | 9 | ||||
-rw-r--r-- | src/irmd/main.c | 16 | ||||
-rw-r--r-- | src/irmd/registry.c | 2 | ||||
-rw-r--r-- | src/irmd/registry.h | 1 |
6 files changed, 17 insertions, 21 deletions
diff --git a/src/ipcpd/normal/pol/complete.c b/src/ipcpd/normal/pol/complete.c index 635b573b..1f3f6031 100644 --- a/src/ipcpd/normal/pol/complete.c +++ b/src/ipcpd/normal/pol/complete.c @@ -131,8 +131,6 @@ void * complete_create(struct nbs * nbs, allocator, (void *) complete)) return NULL; - pthread_join(complete->allocator, NULL); - if (pthread_create(&complete->listener, NULL, listener, (void *) complete)) return NULL; diff --git a/src/irmd/irm_flow.c b/src/irmd/irm_flow.c index 4e7c22ef..6a99b081 100644 --- a/src/irmd/irm_flow.c +++ b/src/irmd/irm_flow.c @@ -31,9 +31,10 @@ #include <stdbool.h> #include <assert.h> -struct irm_flow * irm_flow_create(pid_t n_api, - pid_t n_1_api, - int port_id) +struct irm_flow * irm_flow_create(pid_t n_api, + pid_t n_1_api, + int port_id, + qoscube_t qc) { struct irm_flow * f = malloc(sizeof(*f)); if (f == NULL) @@ -53,6 +54,7 @@ struct irm_flow * irm_flow_create(pid_t n_api, f->n_api = n_api; f->n_1_api = n_1_api; f->port_id = port_id; + f->qc = qc; f->n_rb = shm_rbuff_create(n_api, port_id); if (f->n_rb == NULL) { diff --git a/src/irmd/irm_flow.h b/src/irmd/irm_flow.h index 9a439204..97770117 100644 --- a/src/irmd/irm_flow.h +++ b/src/irmd/irm_flow.h @@ -25,6 +25,7 @@ #include <ouroboros/list.h> #include <ouroboros/shm_rbuff.h> +#include <ouroboros/shared.h> #include <sys/types.h> #include <pthread.h> @@ -42,6 +43,7 @@ struct irm_flow { struct list_head next; int port_id; + qoscube_t qc; pid_t n_api; pid_t n_1_api; @@ -56,9 +58,10 @@ struct irm_flow { pthread_mutex_t state_lock; }; -struct irm_flow * irm_flow_create(pid_t n_api, - pid_t n_1_api, - int port_id); +struct irm_flow * irm_flow_create(pid_t n_api, + pid_t n_1_api, + int port_id, + qoscube_t qc); void irm_flow_destroy(struct irm_flow * f); diff --git a/src/irmd/main.c b/src/irmd/main.c index c666cfd3..39f44c44 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -977,8 +977,7 @@ static int api_announce(pid_t api, return 0; } -static struct irm_flow * flow_accept(pid_t api, - qoscube_t * cube) +static struct irm_flow * flow_accept(pid_t api) { struct irm_flow * f = NULL; struct api_entry * e = NULL; @@ -1076,8 +1075,6 @@ static struct irm_flow * flow_accept(pid_t api, re = e->re; - *cube = re->qos; - pthread_mutex_unlock(&e->state_lock); if (reg_entry_get_state(re) != REG_NAME_FLOW_ARRIVED) { @@ -1138,7 +1135,7 @@ static struct irm_flow * flow_alloc(pid_t api, return NULL; } - f = irm_flow_create(api, ipcp, port_id); + f = irm_flow_create(api, ipcp, port_id, cube); if (f == NULL) { bmp_release(irmd->port_ids, port_id); pthread_rwlock_unlock(&irmd->flows_lock); @@ -1376,7 +1373,7 @@ static struct irm_flow * flow_req_arr(pid_t api, return NULL; } - f = irm_flow_create(h_api, api, port_id); + f = irm_flow_create(h_api, api, port_id, cube); if (f == NULL) { bmp_release(irmd->port_ids, port_id); pthread_rwlock_unlock(&irmd->flows_lock); @@ -1390,7 +1387,6 @@ static struct irm_flow * flow_req_arr(pid_t api, pthread_rwlock_unlock(&irmd->flows_lock); pthread_rwlock_rdlock(&irmd->reg_lock); - re->qos = cube; reg_entry_set_state(re, REG_NAME_FLOW_ARRIVED); e = api_table_get(&irmd->api_table, h_api); @@ -1850,9 +1846,7 @@ void * mainloop(void * o) msg->n_dif_name); break; case IRM_MSG_CODE__IRM_FLOW_ACCEPT: - ret_msg.has_qoscube = true; - e = flow_accept(msg->api, - (qoscube_t *) &ret_msg.qoscube); + e = flow_accept(msg->api); if (e == NULL) { ret_msg.has_result = true; ret_msg.result = -EIRMD; @@ -1862,6 +1856,8 @@ void * mainloop(void * o) ret_msg.port_id = e->port_id; ret_msg.has_api = true; ret_msg.api = e->n_1_api; + ret_msg.has_qoscube = true; + ret_msg.qoscube = e->qc; break; case IRM_MSG_CODE__IRM_FLOW_ALLOC: e = flow_alloc(msg->api, diff --git a/src/irmd/registry.c b/src/irmd/registry.c index c57230f7..2043ca46 100644 --- a/src/irmd/registry.c +++ b/src/irmd/registry.c @@ -53,8 +53,6 @@ static struct reg_entry * reg_entry_create(void) e->name = NULL; e->state = REG_NAME_NULL; - e->response = -1; - return e; } diff --git a/src/irmd/registry.h b/src/irmd/registry.h index cf4ea432..2c766732 100644 --- a/src/irmd/registry.h +++ b/src/irmd/registry.h @@ -64,7 +64,6 @@ struct reg_entry { enum reg_name_state state; qoscube_t qos; - int response; pthread_cond_t state_cond; pthread_mutex_t state_lock; }; |