From bf7f918d283ffaf0f8348ecd815c8aa20bcbb517 Mon Sep 17 00:00:00 2001 From: Marcos Kirsch Date: Sun, 21 Feb 2016 22:12:09 -0600 Subject: [PATCH] Added comments, chunk sized cannot be presently increased. --- httpserver-static.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/httpserver-static.lua b/httpserver-static.lua index 9140b86..178b17b 100644 --- a/httpserver-static.lua +++ b/httpserver-static.lua @@ -4,14 +4,18 @@ return function (connection, req, args) --print("Begin sending:", args.file) + --print("node.heap(): ", node.heap()) dofile("httpserver-header.lc")(connection, 200, args.ext, args.isGzipped) -- Send file in little chunks local continue = true local size = file.list()[args.file] local bytesSent = 0 - local chunkSize = 1024 -- @TODO: can chunkSize be larger? + -- Chunks larger than 1024 don't work. + -- https://github.com/nodemcu/nodemcu-firmware/issues/1075 + local chunkSize = 1024 while continue do collectgarbage() + -- NodeMCU file API lets you open 1 file at a time. -- So we need to open, seek, close each time in order -- to support multiple simultaneous clients.