Added comments, chunk sized cannot be presently increased.

This commit is contained in:
Marcos Kirsch 2016-02-21 22:12:09 -06:00
parent f9d94d9aa2
commit bf7f918d28

View File

@ -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.