summaryrefslogtreecommitdiff
path: root/dht
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2019-10-18 05:10:07 +0000
committerJoe Crayne <joe@jerkface.net>2020-01-01 19:47:41 -0500
commit327359956edf957b571a92e26b8fe89114f7f81d (patch)
tree68cedfc0e2a074be770752dcdc0673b83086a1d5 /dht
parentafe40dd42f257cb90a1de207867a1c399a26e38c (diff)
Port commit afe40dd4 to newer network library
Diffstat (limited to 'dht')
-rw-r--r--dht/src/Network/QueryResponse.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/dht/src/Network/QueryResponse.hs b/dht/src/Network/QueryResponse.hs
index f72763de..27134470 100644
--- a/dht/src/Network/QueryResponse.hs
+++ b/dht/src/Network/QueryResponse.hs
@@ -548,7 +548,9 @@ sockAddrFamily :: SockAddr -> Family
548sockAddrFamily (SockAddrInet _ _ ) = AF_INET 548sockAddrFamily (SockAddrInet _ _ ) = AF_INET
549sockAddrFamily (SockAddrInet6 _ _ _ _) = AF_INET6 549sockAddrFamily (SockAddrInet6 _ _ _ _) = AF_INET6
550sockAddrFamily (SockAddrUnix _ ) = AF_UNIX 550sockAddrFamily (SockAddrUnix _ ) = AF_UNIX
551#if !MIN_VERSION_network(3,0,0)
551sockAddrFamily _ = AF_CAN -- SockAddrCan constructor deprecated 552sockAddrFamily _ = AF_CAN -- SockAddrCan constructor deprecated
553#endif
552 554
553-- | Packets with an empty payload may trigger EOF exception. 555-- | Packets with an empty payload may trigger EOF exception.
554-- 'udpTransport' uses this function to avoid throwing in that 556-- 'udpTransport' uses this function to avoid throwing in that
@@ -619,8 +621,12 @@ udpTransport' bind_address = do
619 -- close sock 621 -- close sock
620 tryTakeMVar isClosed >> putMVar isClosed () 622 tryTakeMVar isClosed >> putMVar isClosed ()
621 -- set O_NONBLOCK using fcntl 623 -- set O_NONBLOCK using fcntl
624 -- NOTE: setNonBlockIfNeeded is a no-op on windows
625#if MIN_VERSION_network (3,1,0)
626 withFdSocket sock $ \fd -> setNonBlockIfNeeded fd
627#else
622 setNonBlockIfNeeded (fdSocket sock) -- setSocketOption sock ??? 0 628 setNonBlockIfNeeded (fdSocket sock) -- setSocketOption sock ??? 0
623 629#endif
624 } 630 }
625 return (tr, sock) 631 return (tr, sock)
626 632