From acb5a26908e95d08ec664f37c7e3a67a99d2c143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Helmut=20H=C3=A4nsel?= Date: Sun, 18 Feb 2024 21:33:03 +0100 Subject: [PATCH] use forceclose in down() per default --- src/Server.jl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Server.jl b/src/Server.jl index d5af93bd9..4de4d45d8 100644 --- a/src/Server.jl +++ b/src/Server.jl @@ -7,7 +7,7 @@ using HTTP, Sockets, HTTP.WebSockets import Millboard, Distributed, Logging import Genie import Distributed -import HTTP.Servers.Listener +import HTTP.Servers: Listener, forceclose """ @@ -253,18 +253,19 @@ end Shuts down the servers optionally indicating which of the `webserver` and `websockets` servers to be stopped. It does not remove the servers from the `SERVERS` collection. Returns the collection. """ -function down(; webserver::Bool = true, websockets::Bool = true) :: Vector{ServersCollection} +function down(; webserver::Bool = true, websockets::Bool = true, force::Bool = true) :: Vector{ServersCollection} for i in 1:length(SERVERS) - down(SERVERS[i]; webserver, websockets) + down(SERVERS[i]; webserver, websockets, force) end SERVERS end -function down(server::ServersCollection; webserver::Bool = true, websockets::Bool = true) :: ServersCollection - webserver && !isnothing(server.webserver) && isopen(server.webserver) && close(server.webserver) - websockets && !isnothing(server.websockets) && isopen(server.websockets) && close(server.websockets) +function down(server::ServersCollection; webserver::Bool = true, websockets::Bool = true, force::Bool = true) :: ServersCollection + close_cmd = force ? forceclose : close + webserver && !isnothing(server.webserver) && isopen(server.webserver) && close_cmd(server.webserver) + websockets && !isnothing(server.websockets) && isopen(server.websockets) && close_cmd(server.websockets) server end