From f21f55bb1e757f27cf9d2263469eb9ae6c63b91e Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 18 Nov 2008 05:13:29 +0000 Subject: Allow us to close client connections, with or without a stream error. Partially fixes #8, we still need the same for s2s (though it should be almost a straight copy of the code, I'm too tired atm) --- core/sessionmanager.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'core/sessionmanager.lua') diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index 0d65f6d6..33157567 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -96,13 +96,23 @@ function streamopened(session, attr) session.host = attr.to or error("Client failed to specify destination hostname"); session.version = tonumber(attr.version) or 0; session.streamid = m_random(1000000, 99999999); - print(session, session.host, "Client opened stream"); - send(""); + (session.log or session)("debug", "Client sent opening to %s", session.host); + + + send(""); send(format("", session.streamid, session.host)); + if not hosts[session.host] then + -- We don't serve this host... + session:disconnect{ condition = "host-unknown", text = "This server does not serve "..tostring(session.host)}; + return; + end + + local features = {}; modulemanager.fire_event("stream-features", session, features); + -- FIXME: Need to send() this all at once send(""); for _, feature in ipairs(features) do -- cgit v1.2.3