From 34115b657fc9ad0dbf5a85e66505bb5df12e1116 Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Sun, 27 Jan 2019 01:50:20 +0100 Subject: [PATCH] =?UTF-8?q?Enfin=20trouv=C3=A9=20ma=20fuite=20de=20m=C3=A9?= =?UTF-8?q?moire,=20je=20fermais=20la=20connection=20au=20lieu=20de=20ferm?= =?UTF-8?q?er=20le=20socket.=20Va=20falloir=20tout=20remttre=20en=20=C3=A9?= =?UTF-8?q?tat=20maintenant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZYX-html-framework/a_test_ram.lua | 4 ++-- ZYX-html-framework/web_srv2.lua | 11 ++--------- ZYX-html-framework/web_srv_test2.lua | 11 +++++++++-- ZYX-html-framework/web_srv_test3.lua | 16 ++++++++++++++++ 4 files changed, 29 insertions(+), 13 deletions(-) create mode 100644 ZYX-html-framework/web_srv_test3.lua diff --git a/ZYX-html-framework/a_test_ram.lua b/ZYX-html-framework/a_test_ram.lua index 1e07d9b..f876967 100644 --- a/ZYX-html-framework/a_test_ram.lua +++ b/ZYX-html-framework/a_test_ram.lua @@ -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") diff --git a/ZYX-html-framework/web_srv2.lua b/ZYX-html-framework/web_srv2.lua index f1a5d5b..f1de64d 100644 --- a/ZYX-html-framework/web_srv2.lua +++ b/ZYX-html-framework/web_srv2.lua @@ -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("

ESP8266
Server is working!

\n\n") - file_html = nil - k = nil - v = nil - _GET = nil - method = nil - path = nil - vars = nil + client:send("

ESP8266
Server is working!

"..tmr.now().."\n\n") -- end diff --git a/ZYX-html-framework/web_srv_test2.lua b/ZYX-html-framework/web_srv_test2.lua index 1ffd669..879b550 100644 --- a/ZYX-html-framework/web_srv_test2.lua +++ b/ZYX-html-framework/web_srv_test2.lua @@ -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("

ESP8266
Server is working!

"..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) diff --git a/ZYX-html-framework/web_srv_test3.lua b/ZYX-html-framework/web_srv_test3.lua new file mode 100644 index 0000000..4e81ff2 --- /dev/null +++ b/ZYX-html-framework/web_srv_test3.lua @@ -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("

ESP8266
Server is working!

"..tmr.now().."\n\n") + + + end) + conn:on("sent", function(c) c:close() end) +end)