mod_c2s, mod_s2s: Bootstrap connection count statistic on module load
[prosody.git] / plugins / mod_s2s / mod_s2s.lua
index 2fda63ceb1d60ea7da59e6cb9884592d04b0b01e..ea186cf0f265f48d5e1d5139b21679a42bcc1281 100644 (file)
@@ -43,6 +43,16 @@ local sessions = module:shared("sessions");
 
 local log = module._log;
 
+do
+       -- Connection counter resets to 0 on load and reload
+       -- Bump it up to current value
+       local count = 0;
+       for _ in pairs(sessions) do
+               count = count + 1;
+       end
+       measure_connections(count);
+end
+
 --- Handle stanzas to remote domains
 
 local bouncy_stanzas = { message = true, presence = true, iq = true };
@@ -363,7 +373,7 @@ function stream_callbacks.streamopened(session, attr)
        elseif session.direction == "outgoing" then
                session.notopen = nil;
                if not attr.id then
-                       log("error", "Stream response did not give us a stream id!");
+                       log("error", "Stream response from %s did not give us a stream id!", session.to_host);
                        session:close({ condition = "undefined-condition", text = "Missing stream ID" });
                        return;
                end
@@ -434,9 +444,6 @@ end
 
 local function handleerr(err) log("error", "Traceback[s2s]: %s", traceback(tostring(err), 2)); end
 function stream_callbacks.handlestanza(session, stanza)
-       if stanza.attr.xmlns == "jabber:client" then --COMPAT: Prosody pre-0.6.2 may send jabber:client
-               stanza.attr.xmlns = nil;
-       end
        stanza = session.filter("stanzas/in", stanza);
        if stanza then
                return xpcall(function () return core_process_stanza(session, stanza) end, handleerr);
@@ -680,7 +687,7 @@ module:hook("server-stopping", function(event)
        for _, session in pairs(sessions) do
                session:close{ condition = "system-shutdown", text = reason };
        end
-end,500);
+end, -200);