aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_bosh.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-10-03 14:59:11 +0200
committerKim Alvefur <zash@zash.se>2020-10-03 14:59:11 +0200
commit5445517b5d8dbd5260a98362a8e93b4d8711bea5 (patch)
tree9b024ec62950e978005e157f40b31de920000c49 /plugins/mod_bosh.lua
parent2940b9c66f4a053dbe2ca038468a3a8791beccd5 (diff)
downloadprosody-5445517b5d8dbd5260a98362a8e93b4d8711bea5.tar.gz
prosody-5445517b5d8dbd5260a98362a8e93b4d8711bea5.zip
mod_bosh: Pick out the 'wait' before checking it instead of earlier
Going to add more host related checks, so to keep the wait variable closer to the related checks
Diffstat (limited to 'plugins/mod_bosh.lua')
-rw-r--r--plugins/mod_bosh.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua
index d4701148..7f750613 100644
--- a/plugins/mod_bosh.lua
+++ b/plugins/mod_bosh.lua
@@ -269,7 +269,6 @@ function stream_callbacks.streamopened(context, attr)
context.notopen = nil; -- Signals that we accept this opening tag
local to_host = nameprep(attr.to);
- local wait = tonumber(attr.wait);
if not to_host then
log("debug", "BOSH client tried to connect to invalid host: %s", tostring(attr.to));
local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",
@@ -277,6 +276,8 @@ function stream_callbacks.streamopened(context, attr)
response:send(tostring(close_reply));
return;
end
+
+ local wait = tonumber(attr.wait);
if not rid or (not attr.wait or not wait or wait < 0 or wait % 1 ~= 0) then
log("debug", "BOSH client sent invalid rid or wait attributes: rid=%s, wait=%s", tostring(attr.rid), tostring(attr.wait));
local close_reply = st.stanza("body", { xmlns = xmlns_bosh, type = "terminate",