From df1952ca04743156843326b4406887fb0939aa25 Mon Sep 17 00:00:00 2001 From: ollo Date: Sat, 23 Mar 2019 00:29:18 +0100 Subject: [PATCH] Tweaking arround --- webserver.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/webserver.lua b/webserver.lua index 8568412..9f18198 100644 --- a/webserver.lua +++ b/webserver.lua @@ -47,8 +47,8 @@ function sendPage(conn, nameOfFile, replaceMap) end buf = buf .. line - -- Sent after 1k data - if (string.len(buf) >= 700) then + -- Sent after 500 bytes data + if ( (string.len(buf) >= 500) or (node.heap() < 2000) ) then line=nil conn:send(buf) print("Sent part of " .. sentBytes .. "B") @@ -128,9 +128,10 @@ function startWebServer() if (payload:find("GET /") ~= nil) then --here is code for handling http request from a web-browser + collectgarbage() if (sendPage ~= nil) then - print("Sending webpage.html ...") + print("Sending webpage.html (" .. tostring(node.heap()) .. "B free) ...") -- Load the sendPagewebcontent replaceMap=fillDynamicMap() sendPage(conn, "webpage.html", replaceMap)