diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2017-03-21 15:52:01 +0000 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@ugent.be> | 2017-03-21 15:52:01 +0000 |
commit | ebb8a6ce66832ba9c963f1454b5b97fe5e15bd00 (patch) | |
tree | 58425710a8232125faebc48a339797bc3ae1b4b4 | |
parent | b04b4933fc7f03aef940b4de5fd43815834951ca (diff) | |
parent | 97d2a1c3c185623c5472e89e78b4d8cc98a06c91 (diff) | |
download | ouroboros-ebb8a6ce66832ba9c963f1454b5b97fe5e15bd00.tar.gz ouroboros-ebb8a6ce66832ba9c963f1454b5b97fe5e15bd00.zip |
Merged in sandervrijders/ouroboros/testing-local (pull request #408)
ipcpd: local: Handle failed flow allocation
-rw-r--r-- | include/ouroboros/ipcp-dev.h | 6 | ||||
-rw-r--r-- | src/ipcpd/local/main.c | 8 |
2 files changed, 10 insertions, 4 deletions
diff --git a/include/ouroboros/ipcp-dev.h b/include/ouroboros/ipcp-dev.h index 81aca1d7..b2d78c6e 100644 --- a/include/ouroboros/ipcp-dev.h +++ b/include/ouroboros/ipcp-dev.h @@ -29,9 +29,9 @@ int ipcp_create_r(pid_t api, int result); -int ipcp_flow_req_arr(pid_t api, - char * dst_name, - char * src_ae_name, +int ipcp_flow_req_arr(pid_t api, + char * dst_name, + char * src_ae_name, qoscube_t cube); int ipcp_flow_alloc_reply(int fd, diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index 8d770c94..edb22be6 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -234,13 +234,19 @@ static int ipcp_local_flow_alloc(int fd, if (ipcp_get_state() != IPCP_OPERATIONAL) { pthread_rwlock_unlock(&ipcpi.state_lock); - log_dbg("Won't register with non-enrolled IPCP."); + log_dbg("Won't allocate over non-operational IPCP."); return -1; /* -ENOTENROLLED */ } pthread_rwlock_wrlock(&local_data.lock); out_fd = ipcp_flow_req_arr(getpid(), dst_name, src_ae_name, cube); + if (out_fd < 0) { + log_dbg("Flow allocation failed."); + pthread_rwlock_unlock(&local_data.lock); + pthread_rwlock_unlock(&ipcpi.state_lock); + return -1; + } local_data.in_out[fd] = out_fd; local_data.in_out[out_fd] = fd; |