haskell-hvr / missingh

Utility library [Haskell]
https://hackage.haskell.org/package/MissingH
Other
87 stars 40 forks source link

Close sockets on connection failure #50

Closed defanor closed 5 years ago

defanor commented 5 years ago

Sockets created with connectTCP were neither closed nor returned in case of a failure to connect, leading to file descriptor leaks.

hvr commented 5 years ago

Good catch! Thanks!

But to be fair, the GC is supposed to kick in at some point and close the dangling sockets when they become garbage. But eagerly closing the sockets on failure is definitely desirable!