소스 검색

Fix a memory leak when the connection is dropped by the client side

Anton Andersen 8 년 전
부모
커밋
1ddd47eaf9
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      httpserver.lua

+ 6 - 0
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
    )