From 2a714cd0640a5a0f41faf481acbe416ed1d87451 Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Thu, 5 Jan 2023 17:28:24 +0100 Subject: [PATCH] Service name from ipcd to ipc. Some comments changes. --- zig-impl/src/context.zig | 2 +- zig-impl/src/ipcd.zig | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/zig-impl/src/context.zig b/zig-impl/src/context.zig index 69f7a11..280b981 100644 --- a/zig-impl/src/context.zig +++ b/zig-impl/src/context.zig @@ -130,7 +130,7 @@ pub const Context = struct { try lookupwriter.print("{s};{s}", .{service_name, network_envvar}); // Try to connect to the IPCd service - var ipcdfd = try self.connect_service("ipcd"); + var ipcdfd = try self.connect_service("ipc"); defer self.close_fd (ipcdfd) catch {}; // in any case, connection should be closed // Send LOOKUP message diff --git a/zig-impl/src/ipcd.zig b/zig-impl/src/ipcd.zig index bc6127d..a32a2aa 100644 --- a/zig-impl/src/ipcd.zig +++ b/zig-impl/src/ipcd.zig @@ -17,16 +17,14 @@ const print = std.debug.print; const testing = std.testing; const print_eq = @import("./util.zig").print_eq; -// TODO: standard library is unecessary complex regarding networking. -// Should libipc drop it and use plain old file descriptors instead? +// Standard library is unecessary complex regarding networking. +// libipc drops it and uses plain old file descriptors instead. -// TODO: path => std.XXX.YYY, not simple [] const u8 +// API should completely obfuscate the inner structures. +// Only libipc structures should be necessary to write any networking code, +// users should only work with Context and Message, mostly. -// TODO: both Connection and pollfd store file descriptors. -// Connection stores either Stream (server) or Address (client). - -// TODO: API should completely obfuscate the inner structures. -// Only structures in this file should be necessary. +// QUESTION: should libipc use std.fs.path and not simple [] const u8? fn create_service() !void { const config = .{.safety = true}; @@ -38,7 +36,7 @@ fn create_service() !void { defer ctx.deinit(); // There. Can't leak. Isn't Zig wonderful? // SERVER SIDE: creating a service. - _ = try ctx.server_init("ipcd"); + _ = try ctx.server_init("ipc"); // signal handler, to quit when asked const S = struct {