A websocket implementation for zig
0

Configure Feed

Select the types of activity you want to include in your feed.

EXPERIMENAL tweaks for httpz 0.16 integration

Karl Seguin (Apr 20, 2026, 8:34 PM +0800) 3be6210f 1c054b86

+8 -10
+8 -10
src/server/server.zig
··· 642 642 _ = try posix.fcntl(socket, posix.F.SETFL, flags & ~nonblocking); 643 643 } 644 644 } 645 - const hc = try self.base.newConn(socket, address, now); 645 + const hc = try self.base.newConn(socket, address.toIOAddress(), now); 646 646 self.loop.monitorRead(hc, false) catch |err| { 647 647 self.base.cleanupConn(hc); 648 648 return err; ··· 766 766 } 767 767 } 768 768 769 - fn newConn(self: *Self, socket: posix.socket_t, address: posix.Address, time: u32) !*HandlerConn(H) { 769 + fn newConn(self: *Self, socket: posix.socket_t, address: Io.net.IpAddress, time: u32) !*HandlerConn(H) { 770 770 return self.conn_manager.create(socket, address, time); 771 771 } 772 772 ··· 1022 1022 const Self = @This(); 1023 1023 const W = if (blockingMode()) Blocking(H) else NonBlockingBase(H, false); 1024 1024 1025 - pub fn init(allocator: Allocator, state: *WorkerState) !Self { 1025 + pub fn init(io: Io, allocator: Allocator, state: *WorkerState) !Self { 1026 1026 return .{ 1027 - .worker = try W.init(allocator, state), 1027 + .worker = try W.init(io, allocator, state), 1028 1028 }; 1029 1029 } 1030 1030 ··· 1032 1032 self.worker.deinit(); 1033 1033 } 1034 1034 1035 - pub fn createConn(self: *Self, socket: posix.socket_t, address: posix.Address, now: u32) !*HandlerConn(H) { 1035 + pub fn createConn(self: *Self, socket: posix.socket_t, address: Io.net.IpAddress, now: u32) !*HandlerConn(H) { 1036 1036 return self.worker.conn_manager.create(socket, address, now); 1037 1037 } 1038 1038 ··· 1178 1178 return self.active.len + self.pending.len; 1179 1179 } 1180 1180 1181 - pub fn create(self: *Self, socket: posix.socket_t, address: posix.Address, now: u32) !*HandlerConn(H) { 1181 + pub fn create(self: *Self, socket: posix.socket_t, address: Io.net.IpAddress, now: u32) !*HandlerConn(H) { 1182 1182 const io = self.io; 1183 1183 errdefer posix.close(socket); 1184 - 1185 - const ip_address = address.toIOAddress(); 1186 1184 1187 1185 self.lock.lockUncancelable(io); 1188 1186 defer self.lock.unlock(io); ··· 1200 1198 ._closed = false, 1201 1199 .started = now, 1202 1200 .address = address, 1203 - .stream = .{ .socket = .{ .handle = socket, .address = ip_address } }, 1201 + .stream = .{ .socket = .{ .handle = socket, .address = address } }, 1204 1202 .compression = null, 1205 1203 }, 1206 1204 }; ··· 1348 1346 _closed: bool, 1349 1347 started: u32, 1350 1348 stream: Io.net.Stream, 1351 - address: posix.Address, 1349 + address: Io.net.IpAddress, 1352 1350 lock: Io.Mutex = .init, 1353 1351 compression: ?*Conn.Compression = null, 1354 1352