Merge wayward 0.11.10 tag commit 0.11
authorKim Alvefur <zash@zash.se>
Fri, 01 Oct 2021 00:21:49 +0200
branch0.11
changeset 11829 07a72f0a32df
parent 11815 ae43166fe931 (diff)
parent 11828 90a474aab2c1 (current diff)
child 11836 30ca1be53829
child 11848 0f786c4a2cb2
Merge wayward 0.11.10 tag commit
--- a/makefile	Tue Aug 03 11:44:31 2021 +0200
+++ b/makefile	Fri Oct 01 00:21:49 2021 +0200
@@ -90,12 +90,12 @@
 	sed 's|certs/|$(INSTALLEDCONFIG)/certs/|' prosody.cfg.lua.dist > $@
 
 prosody.version:
-	test -f prosody.release && \
-		cp prosody.release $@ || \
-		test -f .hg_archival.txt && \
-		sed -n 's/^node: \(............\).*/\1/p' .hg_archival.txt > $@ || \
-		test -f .hg/dirstate && \
-		hexdump -n6 -e'6/1 "%02x"' .hg/dirstate > $@ || \
-		echo unknown > $@
-
-
+	if [ -f prosody.release ]; then \
+		cp prosody.release $@; \
+	elif [ -f .hg_archival.txt ]; then \
+		sed -n 's/^node: \(............\).*/\1/p' .hg_archival.txt > $@; \
+	elif [ -f .hg/dirstate ]; then \
+		hexdump -n6 -e'6/1 "%02x"' .hg/dirstate > $@; \
+	else \
+		echo unknown > $@; \
+	fi
--- a/net/server_epoll.lua	Tue Aug 03 11:44:31 2021 +0200
+++ b/net/server_epoll.lua	Fri Oct 01 00:21:49 2021 +0200
@@ -58,6 +58,9 @@
 	-- Maximum and minimum amount of time to sleep waiting for events (adjusted for pending timers)
 	max_wait = 86400;
 	min_wait = 1e-06;
+
+	--- How long to wait after getting the shutdown signal before forcefully tearing down every socket
+	shutdown_deadline = 5;
 }};
 local cfg = default_config.__index;
 
@@ -122,8 +125,8 @@
 	end
 
 	if readd then
-		for _, timer in pairs(readd) do
-			timers:insert(timer, timer[1]);
+		for id, timer in pairs(readd) do
+			timers:insert(timer, timer[1], id);
 		end
 		peek = timers:peek();
 	end
@@ -743,6 +746,21 @@
 	if quit then
 		quitting = "quitting";
 		closeall();
+		addtimer(1, function ()
+			if quitting then
+				closeall();
+				return 1;
+			end
+		end);
+		if cfg.shutdown_deadline then
+			addtimer(cfg.shutdown_deadline, function ()
+				if quitting then
+					for fd, conn in pairs(fds) do -- luacheck: ignore 213/fd
+						conn:destroy();
+					end
+				end
+			end);
+		end
 	else
 		quitting = nil;
 	end
--- a/plugins/mod_c2s.lua	Tue Aug 03 11:44:31 2021 +0200
+++ b/plugins/mod_c2s.lua	Fri Oct 01 00:21:49 2021 +0200
@@ -108,7 +108,10 @@
 		send(features);
 	else
 		(session.log or log)("warn", "No stream features to offer");
-		session:close{ condition = "undefined-condition", text = "No stream features to proceed with" };
+		session:close({
+			condition = "undefined-condition";
+			text = "No stream features to proceed with on "..(session.secure and "" or "in").."secure stream";
+		});
 	end
 end
 
--- a/prosodyctl	Tue Aug 03 11:44:31 2021 +0200
+++ b/prosodyctl	Fri Oct 01 00:21:49 2021 +0200
@@ -203,7 +203,7 @@
 	if prosody.installed and configmanager.get("*", "prosodyctl_service_warnings") ~= false then
 		show_warning("WARNING: Use of prosodyctl start/stop/restart/reload is not recommended");
 		show_warning("         if Prosody is managed by an init system - use that directly instead.");
-		lfs = lfs or require
+		lfs = lfs or require"lfs";
 		if lfs.attributes("/etc/systemd") then
 			show_warning("         e.g. systemctl %s prosody", service_command);
 		elseif lfs.attributes("/etc/init.d/prosody") then