Procházet zdrojové kódy

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

Anton Andersen před 8 roky
rodič
revize
1ddd47eaf9
1 změnil soubory, kde provedl 6 přidání a 0 odebrání
  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
    )