From 1a9c9dd9363ac2af3ea097def64ded9f386f3e0d Mon Sep 17 00:00:00 2001 From: Paul Aurich Date: Tue, 6 Oct 2009 11:15:55 +0100 Subject: sessionmanager: Mark client streams as opened sooner to avoid wrapping errors in unnecessary stream tags --- core/sessionmanager.lua | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'core') diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua index bc45d104..08e70d44 100644 --- a/core/sessionmanager.lua +++ b/core/sessionmanager.lua @@ -169,29 +169,30 @@ function streamopened(session, attr) session.version = tonumber(attr.version) or 0; session.streamid = uuid_generate(); (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:close{ condition = "host-unknown", text = "This server does not serve "..tostring(session.host)}; return; end - + + send(""); + send(format("", session.streamid, session.host)); + + (session.log or log)("debug", "Sent reply to client"); + session.notopen = nil; + -- If session.secure is *false* (not nil) then it means we /were/ encrypting -- since we now have a new stream header, session is secured if session.secure == false then session.secure = true; end - + local features = st.stanza("stream:features"); fire_event("stream-features", session, features); - + send(features); - - (session.log or log)("debug", "Sent reply to client"); - session.notopen = nil; + end function streamclosed(session) -- cgit v1.2.3