catch and print all Socket bind exceptions
This commit is contained in:
parent
1fc264a226
commit
3c28cde942
|
@ -865,7 +865,7 @@ mkServerSocket ip port = do
|
|||
sockAddr <- addrAddress <$> resolve (Just $ show . fromHostAddress6 $ ip) (Just port)
|
||||
sock <- socket AF_INET6 Datagram defaultProtocol
|
||||
setSocketOption sock IPv6Only 1
|
||||
bind sock sockAddr
|
||||
bind sock sockAddr `catch` (\e -> putStrLn $ "Caught exception while bind " <> show sock <> " " <> show sockAddr <> ": " <> show (e :: SomeException))
|
||||
pure sock
|
||||
|
||||
-- | create a UDP datagram socket, connected to a destination.
|
||||
|
@ -881,6 +881,6 @@ mkSendSocket srcIp dest destPort = do
|
|||
setSocketOption sendSock IPv6Only 1
|
||||
-- bind to the configured local IP to make sure that outgoing packets are sent from
|
||||
-- this source address
|
||||
bind sendSock srcAddr
|
||||
bind sendSock srcAddr `catch` (\e -> putStrLn $ "Caught exception while mkSendSocket bind " <> show sendSock <> " " <> show srcAddr <> ": " <> show (e :: SomeException))
|
||||
connect sendSock destAddr
|
||||
pure sendSock
|
||||
|
|
Loading…
Reference in a new issue