mod_c2s: Become a shared module and allow being disabled on some virtualhosts
authorKim Alvefur <zash@zash.se>
Tue, 11 Jun 2013 21:18:51 +0200
changeset 5668 5a9318ac92f6
parent 5667 0bf1cdea43f6
child 5669 9345c161481f
mod_c2s: Become a shared module and allow being disabled on some virtualhosts
plugins/mod_c2s.lua
--- a/plugins/mod_c2s.lua	Tue Jun 11 12:55:47 2013 -0400
+++ b/plugins/mod_c2s.lua	Tue Jun 11 21:18:51 2013 +0200
@@ -50,7 +50,7 @@
 	session.streamid = uuid_generate();
 	(session.log or session)("debug", "Client sent opening <stream:stream> to %s", session.host);
 
-	if not hosts[session.host] then
+	if not hosts[session.host] or not hosts[session.host].modules.c2s then
 		-- We don't serve this host...
 		session:close{ condition = "host-unknown", text = "This server does not serve "..tostring(session.host)};
 		return;
@@ -273,6 +273,8 @@
 	sessions[conn] = session;
 end
 
+function module.add_host() end
+
 module:hook("server-stopping", function(event)
 	local reason = event.reason;
 	for _, session in pairs(sessions) do