nimsuggest: fix tcp socket leak (#12377) [backport]

A new socket is created for each iteration and leak immediately thanks
to the accept() call replacing the created socket with the client socket.

This commit fixes that.
This commit is contained in:
alaviss
2019-10-08 06:11:18 +00:00
committed by Andreas Rumpf
parent 0355c64b92
commit e9fa4c9b9c

View File

@@ -319,8 +319,8 @@ proc replTcp(x: ThreadParams) {.thread.} =
server.bindAddr(x.port, x.address)
server.listen()
var inp = "".TaintedString
var stdoutSocket: Socket
while true:
var stdoutSocket = newSocket()
accept(server, stdoutSocket)
stdoutSocket.readLine(inp)