Browse Source

Added comments, chunk sized cannot be presently increased.

Marcos Kirsch 8 years ago
parent
commit
bf7f918d28
1 changed files with 5 additions and 1 deletions
  1. 5 1
      httpserver-static.lua

+ 5 - 1
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.