switch away from deprecated interface
Again the new stuff works back to network-2.4, so no need to adjust cabal bounds.
This commit is contained in:
parent
12db586469
commit
29b6ab467a
2 changed files with 7 additions and 4 deletions
|
@ -127,12 +127,12 @@ getSocket h = do
|
|||
go' :: Int -> AddrInfo -> IO Socket
|
||||
go' 0 _ = error "unable to bind to local socket"
|
||||
go' n addr = do
|
||||
r <- tryIO $ bracketOnError (open addr) sClose (useaddr addr)
|
||||
r <- tryIO $ bracketOnError (open addr) close (useaddr addr)
|
||||
either (const $ go' (pred n) addr) return r
|
||||
open addr = socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr)
|
||||
useaddr addr sock = do
|
||||
preparesocket sock
|
||||
bindSocket sock (addrAddress addr)
|
||||
bind sock (addrAddress addr)
|
||||
use sock
|
||||
#endif
|
||||
preparesocket sock = setSocketOption sock ReuseAddr 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue