Added comments, chunk sized cannot be presently increased.
This commit is contained in:
parent
f9d94d9aa2
commit
bf7f918d28
@ -4,14 +4,18 @@
|
|||||||
|
|
||||||
return function (connection, req, args)
|
return function (connection, req, args)
|
||||||
--print("Begin sending:", args.file)
|
--print("Begin sending:", args.file)
|
||||||
|
--print("node.heap(): ", node.heap())
|
||||||
dofile("httpserver-header.lc")(connection, 200, args.ext, args.isGzipped)
|
dofile("httpserver-header.lc")(connection, 200, args.ext, args.isGzipped)
|
||||||
-- Send file in little chunks
|
-- Send file in little chunks
|
||||||
local continue = true
|
local continue = true
|
||||||
local size = file.list()[args.file]
|
local size = file.list()[args.file]
|
||||||
local bytesSent = 0
|
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
|
while continue do
|
||||||
collectgarbage()
|
collectgarbage()
|
||||||
|
|
||||||
-- NodeMCU file API lets you open 1 file at a time.
|
-- NodeMCU file API lets you open 1 file at a time.
|
||||||
-- So we need to open, seek, close each time in order
|
-- So we need to open, seek, close each time in order
|
||||||
-- to support multiple simultaneous clients.
|
-- to support multiple simultaneous clients.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user