diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-04-25 19:57:46 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-04-25 19:57:46 +0100 |
commit | a8e1a8b7de3f9b9863855d85b8e0fe4954948ebe (patch) | |
tree | 641cfe2a0a570e8fbcdde14a2b797ad23a4ce9bb /plugins/mod_bosh.lua | |
parent | 0558bb4bb6fb21dbeb1e1e209286b88f38bee2c8 (diff) | |
download | prosody-a8e1a8b7de3f9b9863855d85b8e0fe4954948ebe.tar.gz prosody-a8e1a8b7de3f9b9863855d85b8e0fe4954948ebe.zip |
mod_bosh: Optimisation, store reply_before value as waiting_requests value (saves a lookup)
Diffstat (limited to 'plugins/mod_bosh.lua')
-rw-r--r-- | plugins/mod_bosh.lua | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua index c5576004..599e4522 100644 --- a/plugins/mod_bosh.lua +++ b/plugins/mod_bosh.lua @@ -165,8 +165,7 @@ function handle_request(method, body, request) -- We're keeping this request open, to respond later log("debug", "Have nothing to say, so leaving request unanswered for now"); if session.bosh_wait then - request.reply_before = os_time() + session.bosh_wait; - waiting_requests[request] = true; + waiting_requests[request] = os_time() + session.bosh_wait; end end @@ -399,8 +398,8 @@ function on_timer() -- log("debug", "Checking for requests soon to timeout..."); -- Identify requests timing out within the next few seconds local now = os_time() + 3; - for request in pairs(waiting_requests) do - if request.reply_before <= now then + for request, reply_before in pairs(waiting_requests) do + if reply_before <= now then log("debug", "%s was soon to timeout, sending empty response", request.id); -- Send empty response to let the -- client know we're still here |