diff options
Diffstat (limited to 'src')
-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 | ||||
-rw-r--r-- | src/lib/cdap.c | 1 | ||||
-rw-r--r-- | src/lib/cdap_req.c | 13 | ||||
-rw-r--r-- | src/lib/cdap_req.h | 2 |
9 files changed, 32 insertions, 22 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; }; diff --git a/src/lib/cdap.c b/src/lib/cdap.c index 38806c23..b04dcf51 100644 --- a/src/lib/cdap.c +++ b/src/lib/cdap.c @@ -250,6 +250,7 @@ static void cdap_sent_destroy(struct cdap * instance) list_for_each_safe(p, h, &instance->sent) { struct cdap_req * req = list_entry(p, struct cdap_req, next); list_del(&req->next); + cdap_req_cancel(req); cdap_req_destroy(req); } diff --git a/src/lib/cdap_req.c b/src/lib/cdap_req.c index 0b77f266..df748058 100644 --- a/src/lib/cdap_req.c +++ b/src/lib/cdap_req.c @@ -175,3 +175,16 @@ void cdap_req_respond(struct cdap_req * creq, pthread_mutex_unlock(&creq->lock); } + + +void cdap_req_cancel(struct cdap_req * creq) +{ + assert(creq); + + pthread_mutex_lock(&creq->lock); + + creq->state = REQ_NULL; + pthread_cond_broadcast(&creq->cond); + + pthread_mutex_unlock(&creq->lock); +} diff --git a/src/lib/cdap_req.h b/src/lib/cdap_req.h index 592d26a0..648ebc75 100644 --- a/src/lib/cdap_req.h +++ b/src/lib/cdap_req.h @@ -70,6 +70,6 @@ void cdap_req_respond(struct cdap_req * creq, int response, buffer_t data); -enum creq_state cdap_req_get_state(struct cdap_req * creq); +void cdap_req_cancel(struct cdap_req * creq); #endif /* OUROBOROS_CDAP_REQ_H */ |