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:
parent
0355c64b92
commit
e9fa4c9b9c
1 changed files with 1 additions and 1 deletions
|
|
@ -319,8 +319,8 @@ proc replTcp(x: ThreadParams) {.thread.} =
|
||||||
server.bindAddr(x.port, x.address)
|
server.bindAddr(x.port, x.address)
|
||||||
server.listen()
|
server.listen()
|
||||||
var inp = "".TaintedString
|
var inp = "".TaintedString
|
||||||
|
var stdoutSocket: Socket
|
||||||
while true:
|
while true:
|
||||||
var stdoutSocket = newSocket()
|
|
||||||
accept(server, stdoutSocket)
|
accept(server, stdoutSocket)
|
||||||
|
|
||||||
stdoutSocket.readLine(inp)
|
stdoutSocket.readLine(inp)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue