From 1ddd47eaf9787b7e9b5247cc1d0bd1d5592062be Mon Sep 17 00:00:00 2001 From: Anton Andersen Date: Mon, 15 Feb 2016 12:46:54 +0300 Subject: [PATCH] Fix a memory leak when the connection is dropped by the client side --- httpserver.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/httpserver.lua b/httpserver.lua index 273eb16..96bb690 100644 --- a/httpserver.lua +++ b/httpserver.lua @@ -153,6 +153,12 @@ return function (port) connection:on("receive", onReceive) connection:on("sent", onSent) + connection:on("disconnection",function(c) + if connectionThread then + connectionThread = nil + collectgarbage() + end + end) end )