httpserver: fix memory leak

There was a memory leak related to not dropping all references to
fifosock's ssend.
This commit is contained in:
Jedrzej Potoniec 2021-01-04 20:30:19 +01:00 committed by Nathaniel Wesley Filardo
parent c695a451ee
commit 9e08be7b28
1 changed files with 12 additions and 9 deletions

View File

@ -86,19 +86,22 @@ do
local buf = ""
local method, url
local cfini = function()
conn:on("receive", nil)
conn:on("disconnection", nil)
csend(function()
conn:on("sent", nil)
conn:close()
end)
end
local ondisconnect = function(connection)
connection:on("receive", nil)
connection:on("disconnection", nil)
connection:on("sent", nil)
collectgarbage("collect")
end
local cfini = function()
csend(function()
conn:on("sent", nil)
conn:close()
ondisconnect(conn)
end)
end
-- header parser
local cnt_len = 0