Sfoglia il codice sorgente

Merge pull request #50 from TriAnMan/fix-memory-leak

Fix a memory leak when the connection is dropped by the client side
Marcos 8 anni fa
parent
commit
c218c4f5a8
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  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
    )