Mon, 04 Jan 2016 11:04:23 +0000
main.lua: Log connection failures and fire an event
main.lua | file | annotate | diff | comparison | revisions |
--- a/main.lua Mon Jan 04 11:03:31 2016 +0000 +++ b/main.lua Mon Jan 04 11:04:23 2016 +0000 @@ -37,6 +37,10 @@ assert(#img == img_size, "incorrect image size: actual:"..#img.." vs expected: "..img_size.." data: "..#data) response.body = data:sub(end_idx+3); events.fire_event("image-changed", { image = img }); + if not response.partial then + log("warn", "connection to upstream lost"); + events.fire_event("connection-lost"); + end end); end);