summaryrefslogtreecommitdiff
path: root/src/lib/ipcp.c
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2016-08-10 12:27:41 +0200
committerSander Vrijders <[email protected]>2016-08-10 12:54:38 +0200
commit155fbfb32b9a69705a06a5771bd146c1bed22821 (patch)
tree0a9654e87dd7d5818c3ecedd850a6b6f5641e369 /src/lib/ipcp.c
parent3eb6acfd135cdfb82d19a4f445776ea2f13fd4e1 (diff)
downloadouroboros-155fbfb32b9a69705a06a5771bd146c1bed22821.tar.gz
ouroboros-155fbfb32b9a69705a06a5771bd146c1bed22821.zip
ipcp, irmd, lib: Notify IRMd upon IPCP initialization
This will notify the IRMd when the IPCP is initialized and ready to receive messages. Previously a bootstrap could fail since the IPCP was not listening to the socket yet.
Diffstat (limited to 'src/lib/ipcp.c')
-rw-r--r--src/lib/ipcp.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/ipcp.c b/src/lib/ipcp.c
index 141db43d..9ff05e7b 100644
--- a/src/lib/ipcp.c
+++ b/src/lib/ipcp.c
@@ -168,6 +168,31 @@ pid_t ipcp_create(enum ipcp_type ipcp_type)
exit(EXIT_FAILURE);
}
+int ipcp_create_r(pid_t api)
+{
+ irm_msg_t msg = IRM_MSG__INIT;
+ irm_msg_t * recv_msg = NULL;
+ int ret = -1;
+
+ msg.code = IRM_MSG_CODE__IPCP_CREATE_R;
+ msg.has_api = true;
+ msg.api = api;
+
+ recv_msg = send_recv_irm_msg(&msg);
+ if (recv_msg == NULL)
+ return -1;
+
+ if (recv_msg->has_result == false) {
+ irm_msg__free_unpacked(recv_msg, NULL);
+ return -1;
+ }
+
+ ret = recv_msg->result;
+ irm_msg__free_unpacked(recv_msg, NULL);
+
+ return ret;
+}
+
int ipcp_destroy(pid_t api)
{
int status;