network-multicast 0.3.1 → 0.3.2
raw patch · 3 files changed
+10/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Network.Multicast: instance Network.Multicast.IOCompat (Network.Socket.Types.Socket -> Foreign.C.Types.CInt)
+ Network.Multicast: instance Network.Multicast.IOCompat (Network.Socket.Types.Socket -> GHC.Types.IO Foreign.C.Types.CInt)
Files
- ChangeLog +3/−0
- network-multicast.cabal +2/−2
- src/Network/Multicast.hsc +5/−2
ChangeLog view
@@ -1,3 +1,6 @@+# 0.3.2+- Restore compatibility with network-2.0+ # 0.3.1 - Fix [build errors](https://github.com/commercialhaskell/stackage/issues/4589)
network-multicast.cabal view
@@ -1,5 +1,5 @@ name: network-multicast-version: 0.3.1+version: 0.3.2 copyright: 2008-2019 Audrey Tang license: PublicDomain license-file: LICENSE@@ -15,7 +15,7 @@ extra-source-files: examples/sender.hs examples/receiver.hs ChangeLog library- extensions: ForeignFunctionInterface, CPP+ extensions: ForeignFunctionInterface, CPP, FlexibleInstances exposed-modules: Network.Multicast build-depends: base >= 4 && < 5, network, network-bsd hs-source-dirs: src
src/Network/Multicast.hsc view
@@ -102,11 +102,14 @@ -- | Converts the from host byte order to network byte order. foreign import ccall unsafe "htonl" htonl :: Word32 -> Word32 +class IOCompat f where ioCompat :: f -> (Socket -> IO CInt)+instance IOCompat (Socket -> IO CInt) where ioCompat = id+instance IOCompat (Socket -> CInt) where ioCompat = (return .) doSetSocketOption :: Storable a => CInt -> Socket -> a -> IO CInt doSetSocketOption ip_multicast_option sock x = alloca $ \ptr -> do poke ptr x- fd <- fdSocket sock+ fd <- (ioCompat fdSocket) sock c_setsockopt fd _IPPROTO_IP ip_multicast_option (castPtr ptr) (toEnum $ sizeOf x) -- | Enable or disable the loopback mode on a socket created by 'multicastSender'.@@ -149,7 +152,7 @@ Just loc -> Network.Multicast.inet_addr loc #{poke struct ip_mreq, imr_multiaddr} mReqPtr addr #{poke struct ip_mreq, imr_interface} mReqPtr iface- fd <- fdSocket sock+ fd <- (ioCompat fdSocket) sock c_setsockopt fd _IPPROTO_IP flag (castPtr mReqPtr) (#{size struct ip_mreq}) #ifdef mingw32_HOST_OS