|
@@ -62,15 +62,17 @@ end
|
62
|
62
|
|
63
|
63
|
|
64
|
64
|
function wrap_async_run(event,handler)
|
65
|
|
- local result;
|
|
65
|
+ -- Grab a local response so that we can send the http response when
|
|
66
|
+ -- the handler is done.
|
|
67
|
+ local response = event.response;
|
66
|
68
|
local async_func = runner(function (event)
|
67
|
|
- local wait, done = waiter();
|
68
|
|
- result=handler(event);
|
69
|
|
- done();
|
70
|
|
- return result;
|
|
69
|
+ response.status_code = handler(event);
|
|
70
|
+ -- Send the response to the waiting http client.
|
|
71
|
+ response:send();
|
71
|
72
|
end)
|
72
|
73
|
async_func:run(event)
|
73
|
|
- return result;
|
|
74
|
+ -- return true to keep the client http connection open.
|
|
75
|
+ return true;
|
74
|
76
|
end
|
75
|
77
|
|
76
|
78
|
--- Updates presence stanza, by adding identity node
|
|
@@ -136,4 +138,4 @@ return {
|
136
|
138
|
wrap_async_run = wrap_async_run;
|
137
|
139
|
room_jid_match_rewrite = room_jid_match_rewrite;
|
138
|
140
|
update_presence_identity = update_presence_identity;
|
139
|
|
-};
|
|
141
|
+};
|