summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2016-09-02 11:09:13 +0200
committerdimitri staessens <[email protected]>2016-09-02 11:13:14 +0200
commitad28e916756f7075a06f6b54d456676d0c081b36 (patch)
tree2bf62382b76fa87fab0397f2e43d423c7698b7a4 /src/lib
parentfe197a226c0a7755f19a2956294ba435701a42ea (diff)
downloadouroboros-ad28e916756f7075a06f6b54d456676d0c081b36.tar.gz
ouroboros-ad28e916756f7075a06f6b54d456676d0c081b36.zip
lib: ipcp: Decouple flow_dealloc
Sending a dealloc to the irmd moved to its own call.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ipcp.c68
1 files changed, 35 insertions, 33 deletions
diff --git a/src/lib/ipcp.c b/src/lib/ipcp.c
index e8e31e46..01741121 100644
--- a/src/lib/ipcp.c
+++ b/src/lib/ipcp.c
@@ -464,49 +464,51 @@ int ipcp_flow_alloc_reply(pid_t api,
int ipcp_flow_dealloc(pid_t api,
int port_id)
{
- if (api != 0) {
- ipcp_msg_t msg = IPCP_MSG__INIT;
- ipcp_msg_t * recv_msg = NULL;
- int ret = -1;
- msg.code = IPCP_MSG_CODE__IPCP_FLOW_DEALLOC;
- msg.has_port_id = true;
- msg.port_id = port_id;
+ ipcp_msg_t msg = IPCP_MSG__INIT;
+ ipcp_msg_t * recv_msg = NULL;
+ int ret = -1;
- recv_msg = send_recv_ipcp_msg(api, &msg);
- if (recv_msg == NULL)
- return 0;
+ msg.code = IPCP_MSG_CODE__IPCP_FLOW_DEALLOC;
+ msg.has_port_id = true;
+ msg.port_id = port_id;
- if (recv_msg->has_result == false) {
- ipcp_msg__free_unpacked(recv_msg, NULL);
- return 0;
- }
+ recv_msg = send_recv_ipcp_msg(api, &msg);
+ if (recv_msg == NULL)
+ return 0;
- ret = recv_msg->result;
+ if (recv_msg->has_result == false) {
ipcp_msg__free_unpacked(recv_msg, NULL);
+ return 0;
+ }
- return ret;
- } else {
- irm_msg_t msg = IRM_MSG__INIT;
- irm_msg_t * recv_msg = NULL;
- int ret = -1;
+ ret = recv_msg->result;
+ ipcp_msg__free_unpacked(recv_msg, NULL);
+
+ return ret;
+}
- msg.code = IRM_MSG_CODE__IPCP_FLOW_DEALLOC;
- msg.has_port_id = true;
- msg.port_id = port_id;
+int irm_flow_dealloc(int port_id)
+{
+ irm_msg_t msg = IRM_MSG__INIT;
+ irm_msg_t * recv_msg = NULL;
+ int ret = -1;
- recv_msg = send_recv_irm_msg(&msg);
- if (recv_msg == NULL)
- return 0;
+ msg.code = IRM_MSG_CODE__IPCP_FLOW_DEALLOC;
+ msg.has_port_id = true;
+ msg.port_id = port_id;
- if (recv_msg->has_result == false) {
- irm_msg__free_unpacked(recv_msg, NULL);
- return 0;
- }
+ recv_msg = send_recv_irm_msg(&msg);
+ if (recv_msg == NULL)
+ return 0;
- ret = recv_msg->result;
+ if (recv_msg->has_result == false) {
irm_msg__free_unpacked(recv_msg, NULL);
-
- return ret;
+ return 0;
}
+
+ ret = recv_msg->result;
+ irm_msg__free_unpacked(recv_msg, NULL);
+
+ return ret;
}