From 327359956edf957b571a92e26b8fe89114f7f81d Mon Sep 17 00:00:00 2001 From: James Crayne Date: Fri, 18 Oct 2019 05:10:07 +0000 Subject: Port commit afe40dd4 to newer network library --- dht/src/Network/QueryResponse.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'dht') 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 sockAddrFamily (SockAddrInet _ _ ) = AF_INET sockAddrFamily (SockAddrInet6 _ _ _ _) = AF_INET6 sockAddrFamily (SockAddrUnix _ ) = AF_UNIX +#if !MIN_VERSION_network(3,0,0) sockAddrFamily _ = AF_CAN -- SockAddrCan constructor deprecated +#endif -- | Packets with an empty payload may trigger EOF exception. -- 'udpTransport' uses this function to avoid throwing in that @@ -619,8 +621,12 @@ udpTransport' bind_address = do -- close sock tryTakeMVar isClosed >> putMVar isClosed () -- set O_NONBLOCK using fcntl + -- NOTE: setNonBlockIfNeeded is a no-op on windows +#if MIN_VERSION_network (3,1,0) + withFdSocket sock $ \fd -> setNonBlockIfNeeded fd +#else setNonBlockIfNeeded (fdSocket sock) -- setSocketOption sock ??? 0 - +#endif } return (tr, sock) -- cgit v1.2.3