summaryrefslogtreecommitdiff
path: root/src/daq/nginx-lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/daq/nginx-lua')
-rw-r--r--src/daq/nginx-lua/s5-nginx.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/daq/nginx-lua/s5-nginx.lua b/src/daq/nginx-lua/s5-nginx.lua
index f1e3719..ab62bab 100644
--- a/src/daq/nginx-lua/s5-nginx.lua
+++ b/src/daq/nginx-lua/s5-nginx.lua
@@ -49,6 +49,7 @@
-- .....
--
-- location /path/to/hls {
+-- .....
-- log_by_lua 's5.log()';
-- }
--
@@ -57,6 +58,7 @@
-- allow ::1;
-- deny all;
-- limit_conn perserver 1;
+-- lua_check_client_abort on;
-- content_by_lua 's5.fetch()';
-- }
--
@@ -106,6 +108,13 @@ end
function _SFIVE.fetch()
ngx.log(ngx.INFO, "SFive(fetch): client connected")
+
+ local ok, err = ngx.on_abort(function() ngx.exit(ngx.HTTP_GONE) end)
+ if not ok then
+ ngx.log(ngx.ERR, "failed to register the on_abort callback: ", err)
+ ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
+ end
+
while true do
logs = sfive_data:get_keys()
for i, k in ipairs(logs) do