File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,25 +46,25 @@ connect = G.connect
4646-- 'defaultPort' is passed then the system assigns the next available
4747-- use port.
4848bind :: Socket -> SockAddr -> IO ()
49- bind s a = case a of
49+ bind s sa = case sa of
5050 SockAddrUnix p -> do
5151 -- gracefully handle the fact that UNIX systems don't clean up closed UNIX
5252 -- domain sockets, inspired by https://stackoverflow.com/a/13719866
53- res <- try (G. bind s a )
53+ res <- try (G. bind s sa )
5454 case res of
5555 Right () -> return ()
5656 Left e | not (isAlreadyInUseError e) -> throwIO (e :: IOException )
5757 Left e | otherwise -> do
5858 -- socket might be in use, try to connect
59- res2 <- try (G. connect s a )
59+ res2 <- try (G. connect s sa )
6060 case res2 of
6161 Right () -> close s >> throwIO e
6262 Left e2 | not (isDoesNotExistError e2) -> throwIO (e2 :: IOException )
6363 _ -> do
6464 -- socket not actually in use, remove it and retry bind
6565 void (try $ removeFile p :: IO (Either IOError () ))
66- G. bind s a
67- _ -> G. bind s a
66+ G. bind s sa
67+ _ -> G. bind s sa
6868
6969-- | Accept a connection. The socket must be bound to an address and
7070-- listening for connections. The return value is a pair @(conn,
You can’t perform that action at this time.
0 commit comments