From 90e98c328a44b6cc7398b8b9fe9d9a9e36db444f Mon Sep 17 00:00:00 2001 From: Karchnu Date: Mon, 13 Jul 2020 18:40:21 +0200 Subject: [PATCH] IPC::Client has a server_fd property. --- src/ipc/client.cr | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ipc/client.cr b/src/ipc/client.cr index 98448e3..74d962c 100644 --- a/src/ipc/client.cr +++ b/src/ipc/client.cr @@ -1,14 +1,20 @@ class IPC::Client < IPC::Context + property server_fd : Int32 + # By default, this is a client. def initialize(service_name : String) super() - r = LibIPC.ipc_connection(self.pointer, service_name) + serverfd = 0 + + r = LibIPC.ipc_connection(self.pointer, service_name, pointerof(serverfd)) if r.error_code != 0 m = String.new r.error_message.to_slice raise Exception.new "error during connection establishment: #{m}" end + @server_fd = server_fd + # Very important as there are filesystem side-effects. at_exit { close } end