Enfin trouvé ma fuite de mémoire, je fermais la connection au lieu de fermer le socket. Va falloir tout remttre en état maintenant

This commit is contained in:
Christian Zufferey
2019-01-27 01:50:20 +01:00
parent 1c003a13b6
commit 34115b657f
4 changed files with 29 additions and 13 deletions

View File

@@ -28,11 +28,11 @@ file.remove("web_srv.lua")
file.remove("set_time.lua")
]]
tmr.alarm(test_ram_alarm2, 5*1000, tmr.ALARM_SINGLE, function()
tmr.alarm(test_ram_alarm2, 2.5*1000, tmr.ALARM_SINGLE, function()
zram1=node.heap()
-- dofile("telnet_srv2.lua")
-- dofile("web_ide2.lua")
dofile("web_srv_test2.lua")
dofile("web_srv2.lua")
-- dofile("set_time.lua")
-- dofile("web_html.lua")

View File

@@ -1,6 +1,6 @@
-- petit script de serveur WEB avec Active Server Page ZYX
print("\n web_srv2.lua zf190126.1844 \n")
print("\n web_srv2.lua zf190127.0145 \n")
-- send a file from memory to the client; max. line length = 1024 bytes!
function send_file(zclient, zfilename)
@@ -56,14 +56,7 @@ srv:listen(80, function(conn)
]]
conn:send("<h1> ESP8266<BR>Server is working!</h1>\n\n")
file_html = nil
k = nil
v = nil
_GET = nil
method = nil
path = nil
vars = nil
client:send("<h1> ESP8266<BR>Server is working!</h1>"..tmr.now().."\n\n")
-- end

View File

@@ -1,12 +1,17 @@
-- petit script de serveur WEB pour tester les fuite mémoire
print("\n web_srv_test2.lua zf190126.2051 \n")
print("\n web_srv_test2.lua zf190126.2335 \n")
function receiver(sck, data)
print(data)
sck:close()
end
function zclose(sck, data)
print(data)
sck:close()
end
sv = net.createServer()
sv:listen(80, function(conn)
@@ -14,8 +19,10 @@ sv:listen(80, function(conn)
print(request)
-- client:close()
conn:send("<h1> ESP8266<BR>Server is working!</h1>"..tmr.now().."\n\n")
conn:on("sent", function(c) c:close() end)
-- conn:on("sent", function(c) c:close() end)
conn:on("sent", zclose)
end)
conn:on("sent", nil)
-- conn:on("sent", function(c) c:close() end)

View File

@@ -0,0 +1,16 @@
-- petit script de serveur WEB pour tester les fuite mémoire
print("\n web_srv_test3.lua zf190127.0141 \n")
sck_tmr1 = tmr.create()
srv = net.createServer(net.TCP)
srv:listen(80, function(conn)
conn:on("receive", function(client, request)
print(request)
client:send("<h1> ESP8266<BR>Server is working!</h1>"..tmr.now().."\n\n")
end)
conn:on("sent", function(c) c:close() end)
end)