# HG changeset patch # User Matthew Wild # Date 1335380266 -3600 # Node ID 55f690fdc91561d00e77838077921c2c346eb3a9 # Parent e8c35725999368c8ab3b1b120f6953ed2a9cf9fe mod_bosh: Optimisation, store reply_before value as waiting_requests value (saves a lookup) diff -r e8c357259993 -r 55f690fdc915 plugins/mod_bosh.lua --- a/plugins/mod_bosh.lua Wed Apr 25 15:02:27 2012 +0100 +++ b/plugins/mod_bosh.lua Wed Apr 25 19:57:46 2012 +0100 @@ -165,8 +165,7 @@ -- 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 @@ -- 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