Gracefull close ws socket

This commit is contained in:
Nikolay Govorov
2026-03-16 20:20:47 +00:00
parent 0675c23217
commit 6d0dc6cb1e
3 changed files with 13 additions and 2 deletions

View File

@@ -308,10 +308,13 @@ pub fn run(self: *Runtime) void {
const socket = posix.accept(listener.socket, null, null, posix.SOCK.NONBLOCK) catch |err| {
switch (err) {
error.SocketNotListening, error.ConnectionAborted => {
error.SocketNotListening => {
self.pollfds[1] = .{ .fd = -1, .events = 0, .revents = 0 };
self.listener = null;
},
error.ConnectionAborted => {
lp.log.warn(.app, "accept connection aborted", .{});
},
error.WouldBlock => {},
else => {
lp.log.err(.app, "accept", .{ .err = err });