Explorar el Código

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

Anton Andersen hace 8 años
padre
commit
1ddd47eaf9
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  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
    )