From acde8fb7be7720eaf3e57a9da919a3cc8245e14c Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Sat, 9 Mar 2024 19:37:52 +0100 Subject: [PATCH] mzteinit: update to latest Zig --- scripts/mzteinit/src/sock/Server.zig | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/mzteinit/src/sock/Server.zig b/scripts/mzteinit/src/sock/Server.zig index a010225..727bd62 100644 --- a/scripts/mzteinit/src/sock/Server.zig +++ b/scripts/mzteinit/src/sock/Server.zig @@ -8,14 +8,16 @@ const log = std.log.scoped(.server); alloc: std.mem.Allocator, env: *Mutex(std.process.EnvMap), -ss: std.net.StreamServer, +ss: std.net.Server, const Server = @This(); pub fn init(alloc: std.mem.Allocator, sockpath: []const u8, env: *Mutex(std.process.EnvMap)) !Server { - var ss = std.net.StreamServer.init(.{}); - try ss.listen(try std.net.Address.initUnix(sockpath)); - return .{ .alloc = alloc, .ss = ss, .env = env }; + return .{ + .alloc = alloc, + .ss = try (try std.net.Address.initUnix(sockpath)).listen(.{}), + .env = env, + }; } pub fn run(self: *Server) !void { @@ -26,7 +28,7 @@ pub fn run(self: *Server) !void { } } -pub fn handleConnection(self: *Server, con: std.net.StreamServer.Connection) !void { +pub fn handleConnection(self: *Server, con: std.net.Server.Connection) !void { defer con.stream.close(); while (true) { const msg = message.Serverbound.read(con.stream.reader(), self.alloc) catch |e| {