diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-12-28 10:57:04 +0100 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-12-28 10:57:04 +0100 |
commit | 43a3231b03aa0a639bcd8d61784c84095edfdb6e (patch) | |
tree | 3e722461be65504e6658f75b7b651f93bb8764e1 /src/lib/dev.c | |
parent | bd99555a130400cfec1cbdcf5e4eaa08f133d041 (diff) | |
parent | f8e230049143412ac424d4cbfd4ca95b6c7f64e1 (diff) | |
download | ouroboros-43a3231b03aa0a639bcd8d61784c84095edfdb6e.tar.gz ouroboros-43a3231b03aa0a639bcd8d61784c84095edfdb6e.zip |
Merged in dstaesse/ouroboros/be-qoscube (pull request #329)
Some fixes
Diffstat (limited to 'src/lib/dev.c')
-rw-r--r-- | src/lib/dev.c | 42 |
1 files changed, 11 insertions, 31 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c index 8eb98506..3a1df16d 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -176,7 +176,7 @@ static int api_announce(char * ap_name) recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) { - return -1; + return -EIRMD; } if (!recv_msg->has_result || (ret = recv_msg->result)) { @@ -359,7 +359,7 @@ int flow_accept(char ** ae_name, qosspec_t * qos) recv_msg = send_recv_irm_msg_b(&msg); if (recv_msg == NULL) - return -1; + return -EIRMD; if (!recv_msg->has_api || !recv_msg->has_port_id) { irm_msg__free_unpacked(recv_msg, NULL); @@ -465,7 +465,7 @@ int flow_alloc_resp(int fd, int response) recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) - return -1; + return -EIRMD; if (!recv_msg->has_result) { irm_msg__free_unpacked(recv_msg, NULL); @@ -476,16 +476,6 @@ int flow_alloc_resp(int fd, int response) irm_msg__free_unpacked(recv_msg, NULL); - if (response) { - pthread_rwlock_rdlock(&ai.data_lock); - pthread_rwlock_wrlock(&ai.flows_lock); - - reset_flow(fd); - - pthread_rwlock_unlock(&ai.flows_lock); - pthread_rwlock_unlock(&ai.data_lock); - } - return ret; } @@ -517,7 +507,7 @@ int flow_alloc(char * dst_name, char * src_ae_name, qosspec_t * qos) recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) - return -1; + return -EIRMD; if (!recv_msg->has_api || !recv_msg->has_port_id) { irm_msg__free_unpacked(recv_msg, NULL); @@ -603,27 +593,17 @@ int flow_alloc_res(int fd) recv_msg = send_recv_irm_msg_b(&msg); if (recv_msg == NULL) - result = -1; + return -EIRMD; if (!recv_msg->has_result) { irm_msg__free_unpacked(recv_msg, NULL); - result = -1; + return -1; } result = recv_msg->result; irm_msg__free_unpacked(recv_msg, NULL); - if (result) { - pthread_rwlock_rdlock(&ai.data_lock); - pthread_rwlock_wrlock(&ai.flows_lock); - - reset_flow(fd); - - pthread_rwlock_unlock(&ai.flows_lock); - pthread_rwlock_unlock(&ai.data_lock); - } - return result; } @@ -655,9 +635,9 @@ int flow_dealloc(int fd) pthread_rwlock_unlock(&ai.flows_lock); pthread_rwlock_unlock(&ai.data_lock); - recv_msg = send_recv_irm_msg_b(&msg); + recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) - return -1; + return -EIRMD; if (!recv_msg->has_result) { irm_msg__free_unpacked(recv_msg, NULL); @@ -1208,7 +1188,7 @@ int ipcp_create_r(pid_t api) recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) - return -1; + return -EIRMD; if (recv_msg->has_result == false) { irm_msg__free_unpacked(recv_msg, NULL); @@ -1254,7 +1234,7 @@ int ipcp_flow_req_arr(pid_t api, char * dst_name, char * src_ae_name) recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) - return -1; + return -EIRMD; if (!recv_msg->has_port_id || !recv_msg->has_api) { irm_msg__free_unpacked(recv_msg, NULL); @@ -1336,7 +1316,7 @@ int ipcp_flow_alloc_reply(int fd, int response) recv_msg = send_recv_irm_msg(&msg); if (recv_msg == NULL) - return -1; + return -EIRMD; if (recv_msg->has_result == false) { irm_msg__free_unpacked(recv_msg, NULL); |