Diff

plugins/mod_c2s.lua @ 5668:5a9318ac92f6

mod_c2s: Become a shared module and allow being disabled on some virtualhosts
author Kim Alvefur <zash@zash.se>
date Tue, 11 Jun 2013 21:18:51 +0200
parent 5638:c5b7f4858014
child 5669:9345c161481f
line wrap: on
line diff
--- 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