Tweaking arround

This commit is contained in:
ollo 2019-03-23 00:29:18 +01:00
parent aea5608b71
commit df1952ca04

View File

@ -47,8 +47,8 @@ function sendPage(conn, nameOfFile, replaceMap)
end end
buf = buf .. line buf = buf .. line
-- Sent after 1k data -- Sent after 500 bytes data
if (string.len(buf) >= 700) then if ( (string.len(buf) >= 500) or (node.heap() < 2000) ) then
line=nil line=nil
conn:send(buf) conn:send(buf)
print("Sent part of " .. sentBytes .. "B") print("Sent part of " .. sentBytes .. "B")
@ -128,9 +128,10 @@ function startWebServer()
if (payload:find("GET /") ~= nil) then if (payload:find("GET /") ~= nil) then
--here is code for handling http request from a web-browser --here is code for handling http request from a web-browser
collectgarbage()
if (sendPage ~= nil) then if (sendPage ~= nil) then
print("Sending webpage.html ...") print("Sending webpage.html (" .. tostring(node.heap()) .. "B free) ...")
-- Load the sendPagewebcontent -- Load the sendPagewebcontent
replaceMap=fillDynamicMap() replaceMap=fillDynamicMap()
sendPage(conn, "webpage.html", replaceMap) sendPage(conn, "webpage.html", replaceMap)