185 core_process_stanza(session, stanza); |
185 core_process_stanza(session, stanza); |
186 end |
186 end |
187 end |
187 end |
188 |
188 |
189 function on_timer() |
189 function on_timer() |
190 log("debug", "Checking for requests soon to timeout..."); |
190 -- log("debug", "Checking for requests soon to timeout..."); |
191 -- Identify requests timing out within the next few seconds |
191 -- Identify requests timing out within the next few seconds |
192 local now = os_time() + 3; |
192 local now = os_time() + 3; |
193 for request in pairs(waiting_requests) do |
193 for request in pairs(waiting_requests) do |
194 if request.reply_before <= now then |
194 if request.reply_before <= now then |
195 log("debug", "%s was soon to timeout, sending empty response", request.id); |
195 log("debug", "%s was soon to timeout, sending empty response", request.id); |
196 -- Send empty response to let the |
196 -- Send empty response to let the |
197 -- client know we're still here |
197 -- client know we're still here |
198 if request.conn then |
198 if request.conn then |
199 sessions[request.sid].send(""); |
199 sessions[request.sid].send(""); |
200 end |
200 end |
201 else |
|
202 log("debug", "%s timing out in %ds [destroyed: %s]", request.id, request.reply_before - now, tostring(request.destroyed)); |
|
203 end |
|
204 if not request.on_destroy then |
|
205 log("warn", "%s has no on_destroy!", request.id); |
|
206 end |
201 end |
207 end |
202 end |
208 end |
203 end |
209 |
204 |
210 httpserver.new{ port = 5280, base = "http-bind", handler = handle_request, ssl = false} |
205 httpserver.new{ port = 5280, base = "http-bind", handler = handle_request, ssl = false} |