mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-02-05 14:57:11 +00:00
Merge pull request #1470 from lightpanda-io/fix_bsd_test_server_shutdown
use close, not shutdown on BSD/Mac
This commit is contained in:
@@ -41,9 +41,10 @@ pub fn deinit(self: *TestHTTPServer) void {
|
||||
pub fn stop(self: *TestHTTPServer) void {
|
||||
self.shutdown.store(true, .release);
|
||||
if (self.listener) |*listener| {
|
||||
// Use shutdown to unblock accept(). On Linux this causes accept to
|
||||
// return error.SocketNotListening. close() alone doesn't interrupt accept().
|
||||
std.posix.shutdown(listener.stream.handle, .recv) catch {};
|
||||
switch (@import("builtin").target.os.tag) {
|
||||
.linux => std.posix.shutdown(listener.stream.handle, .recv) catch {},
|
||||
else => std.posix.close(listener.stream.handle),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user