httpserver: fix memory leak
There was a memory leak related to not dropping all references to fifosock's ssend.
This commit is contained in:
parent
c695a451ee
commit
9e08be7b28
|
@ -86,19 +86,22 @@ do
|
||||||
local buf = ""
|
local buf = ""
|
||||||
local method, url
|
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)
|
local ondisconnect = function(connection)
|
||||||
|
connection:on("receive", nil)
|
||||||
|
connection:on("disconnection", nil)
|
||||||
connection:on("sent", nil)
|
connection:on("sent", nil)
|
||||||
collectgarbage("collect")
|
collectgarbage("collect")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local cfini = function()
|
||||||
|
csend(function()
|
||||||
|
conn:on("sent", nil)
|
||||||
|
conn:close()
|
||||||
|
ondisconnect(conn)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- header parser
|
-- header parser
|
||||||
local cnt_len = 0
|
local cnt_len = 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue