mod_bosh: Fix traceback when initiating a BOSH session to an unknown host
authorMatthew Wild <mwild1@gmail.com>
Fri, 10 Sep 2010 16:56:24 +0000 (17:56 +0100)
committerMatthew Wild <mwild1@gmail.com>
Fri, 10 Sep 2010 16:56:24 +0000 (17:56 +0100)
plugins/mod_bosh.lua

index b9106083c16b0421df857ada3a0e3ba8a1d29c24..4e78cd63263a2d99491097607615d82b02481ba6 100644 (file)
@@ -218,9 +218,9 @@ function stream_callbacks.streamopened(request, attr)
                if not hosts[attr.to] then
                        -- Unknown host
                        log("debug", "BOSH client tried to connect to unknown host: %s", tostring(attr.to));
-                       session_close_reply.body.attr.condition = "host-unknown";
-                       request:send(session_close_reply);
-                       request.notopen = nil
+                       local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
+                               ["xmlns:streams"] = xmlns_streams, condition = "host-unknown" });
+                       request:send(tostring(close_reply));
                        return;
                end