File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 62
62
-- > return sock
63
63
-- > loop sock = forever $ E.bracketOnError (accept sock) (close . fst)
64
64
-- > $ \(conn, _peer) -> void $
65
+ -- > -- 'forkFinally' alone is unlikely to fail thus leaking @conn@,
66
+ -- > -- but 'E.bracketOnError' above will be necessary if some
67
+ -- > -- non-atomic setups (e.g. spawning a subprocess to handle
68
+ -- > -- @conn@) before proper cleanup of @conn@ is your case
65
69
-- > forkFinally (server conn) (const $ gracefulClose conn 5000)
66
70
--
67
71
-- > {-# LANGUAGE OverloadedStrings #-}
Original file line number Diff line number Diff line change @@ -39,4 +39,8 @@ runTCPServer mhost port server = withSocketsDo $ do
39
39
return sock
40
40
loop sock = forever $ E. bracketOnError (accept sock) (close . fst )
41
41
$ \ (conn, _peer) -> void $
42
+ -- 'forkFinally' alone is unlikely to fail thus leaking @conn@,
43
+ -- but 'E.bracketOnError' above will be necessary if some
44
+ -- non-atomic setups (e.g. spawning a subprocess to handle
45
+ -- @conn@) before proper cleanup of @conn@ is your case
42
46
forkFinally (server conn) (const $ gracefulClose conn 5000 )
You can’t perform that action at this time.
0 commit comments