From 7e33b1f89e2eb7c4b6fd92fdbd89a65e93c25d3a Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Mon, 6 Apr 2020 19:27:50 +0200 Subject: [PATCH] Support network >= 3.0.0.0 See https://hackage.haskell.org/package/network-3.0.0.0/changelog mkSocket now only needs the file descriptor --- Network/Socket/Activation.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Network/Socket/Activation.hs b/Network/Socket/Activation.hs index ca5d629..a80fe81 100644 --- a/Network/Socket/Activation.hs +++ b/Network/Socket/Activation.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE ForeignFunctionInterface #-} -- | This is a module for systemd socket activation. See -- and @@ -33,6 +34,9 @@ getActivatedSockets = runMaybeT $ do mapM makeSocket [fdStart .. fdStart + listenFDs - 1] where makeSocket :: CInt -> MaybeT IO Socket makeSocket fd = do +#if MIN_VERSION_network(3,0,0) + lift $ mkSocket fd +#else fam <- socketFamily fd typ <- socketType fd stat <- socketStatus fd @@ -72,3 +76,5 @@ foreign import ccall unsafe "socket_type" foreign import ccall unsafe "socket_listening" c_socket_listening :: CInt -> IO CInt + +#endif