packages feed

streaming-commons 0.2.2.6 → 0.2.3.0

raw patch · 5 files changed

+27/−50 lines, 5 files

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # ChangeLog for streaming-commons +## 0.2.3.0++* Allow Unix sockets on Windows (https://github.com/fpco/streaming-commons/pull/80)+ ## 0.2.2.6  * Remove the zlib headers [#72](https://github.com/fpco/streaming-commons/issues/72)
Data/Streaming/Network.hs view
@@ -8,30 +8,24 @@     , HostPreference     , Message (..)     , AppData-#if !WINDOWS     , ServerSettingsUnix     , ClientSettingsUnix     , AppDataUnix-#endif       -- ** Smart constructors     , serverSettingsTCP     , serverSettingsTCPSocket     , clientSettingsTCP     , serverSettingsUDP     , clientSettingsUDP-#if !WINDOWS     , serverSettingsUnix     , clientSettingsUnix-#endif     , message       -- ** Classes     , HasPort (..)     , HasAfterBind (..)     , HasReadWrite (..)     , HasReadBufferSize (..)-#if !WINDOWS     , HasPath (..)-#endif       -- ** Setters     , setPort     , setHost@@ -39,9 +33,7 @@     , setAfterBind     , setNeedLocalAddr     , setReadBufferSize-#if !WINDOWS     , setPath-#endif       -- ** Getters     , getPort     , getHost@@ -49,9 +41,7 @@     , getAfterBind     , getNeedLocalAddr     , getReadBufferSize-#if !WINDOWS     , getPath-#endif     , appRead     , appWrite     , appSockAddr@@ -82,13 +72,11 @@     , bindPortUDP     , bindRandomPortUDP     , getSocketUDP-#if !WINDOWS       -- ** Unix     , bindPath     , getSocketUnix     , runUnixServer     , runUnixClient-#endif     ) where  import qualified Network.Socket as NS@@ -265,7 +253,6 @@ defaultReadBufferSize = unsafeDupablePerformIO $   bracket (NS.socket NS.AF_INET NS.Stream 0) NS.close (\sock -> NS.getSocketOption sock NS.RecvBuffer) -#if !WINDOWS -- | Attempt to connect to the given Unix domain socket path. getSocketUnix :: FilePath -> IO Socket getSocketUnix path = do@@ -317,7 +304,6 @@     { clientPath = path     , clientReadBufferSizeUnix = defaultReadBufferSize     }-#endif  #if defined(__GLASGOW_HASKELL__) && WINDOWS -- Socket recv and accept calls on Windows platform cannot be interrupted when compiled with -threaded.@@ -495,7 +481,6 @@ getAddrFamily :: ClientSettings -> NS.Family getAddrFamily = clientAddrFamily -#if !WINDOWS class HasPath a where     pathLens :: Functor f => (FilePath -> f FilePath) -> a -> f a instance HasPath ServerSettingsUnix where@@ -508,7 +493,6 @@  setPath :: HasPath a => FilePath -> a -> a setPath p = runIdentity . pathLens (const (Identity p))-#endif  setNeedLocalAddr :: Bool -> ServerSettings -> ServerSettings setNeedLocalAddr x y = y { serverNeedLocalAddr = x }@@ -520,10 +504,8 @@     afterBindLens :: Functor f => ((Socket -> IO ()) -> f (Socket -> IO ())) -> a -> f a instance HasAfterBind ServerSettings where     afterBindLens f ss = fmap (\p -> ss { serverAfterBind = p }) (f (serverAfterBind ss))-#if !WINDOWS instance HasAfterBind ServerSettingsUnix where     afterBindLens f ss = fmap (\p -> ss { serverAfterBindUnix = p }) (f (serverAfterBindUnix ss))-#endif  getAfterBind :: HasAfterBind a => a -> (Socket -> IO ()) getAfterBind = getConstant . afterBindLens Constant@@ -540,14 +522,12 @@ -- | Since 0.1.13 instance HasReadBufferSize ClientSettings where     readBufferSizeLens f cs = fmap (\p -> cs { clientReadBufferSize = p }) (f (clientReadBufferSize cs))-#if !WINDOWS -- | Since 0.1.13 instance HasReadBufferSize ServerSettingsUnix where     readBufferSizeLens f ss = fmap (\p -> ss { serverReadBufferSizeUnix = p }) (f (serverReadBufferSizeUnix ss)) -- | Since 0.1.14 instance HasReadBufferSize ClientSettingsUnix where     readBufferSizeLens f ss = fmap (\p -> ss { clientReadBufferSizeUnix = p }) (f (clientReadBufferSizeUnix ss))-#endif  -- | Get buffer size used when reading from socket. --@@ -640,11 +620,9 @@ instance HasReadWrite AppData where     readLens f a = fmap (\x -> a { appRead' = x }) (f (appRead' a))     writeLens f a = fmap (\x -> a { appWrite' = x }) (f (appWrite' a))-#if !WINDOWS instance HasReadWrite AppDataUnix where     readLens f a = fmap (\x -> a { appReadUnix = x }) (f (appReadUnix a))     writeLens f a = fmap (\x -> a { appWriteUnix = x }) (f (appWriteUnix a))-#endif  appRead :: HasReadWrite a => a -> IO ByteString appRead = getConstant . readLens Constant@@ -652,7 +630,6 @@ appWrite :: HasReadWrite a => a -> ByteString -> IO () appWrite = getConstant . writeLens Constant -#if !WINDOWS -- | Run an @Application@ with the given settings. This function will create a -- new listening socket, accept connections on it, and spawn a new thread for -- each connection.@@ -686,4 +663,3 @@         { appReadUnix = safeRecv sock readBufferSize         , appWriteUnix = sendAll sock         })-#endif
Data/Streaming/Network/Internal.hs view
@@ -5,11 +5,9 @@     , HostPreference (..)     , Message (..)     , AppData (..)-#if !WINDOWS     , ServerSettingsUnix (..)     , ClientSettingsUnix (..)     , AppDataUnix (..)-#endif     ) where  import Data.String (IsString (..))@@ -73,7 +71,6 @@     fromString "!6" = HostIPv6Only     fromString s = Host s -#if !WINDOWS -- | Settings for a Unix domain sockets server. data ServerSettingsUnix = ServerSettingsUnix     { serverPath :: !FilePath@@ -92,7 +89,6 @@     { appReadUnix :: !(IO ByteString)     , appWriteUnix :: !(ByteString -> IO ())     }-#endif  -- | Representation of a single UDP message data Message = Message { msgData :: {-# UNPACK #-} !ByteString
Data/Streaming/Zlib/Lowlevel.hs view
@@ -23,6 +23,7 @@     , c_call_inflate_set_dictionary     ) where +import Data.Functor (void) import Foreign.C import Foreign.Ptr import Codec.Compression.Zlib (WindowBits (WindowBits))@@ -43,19 +44,19 @@  foreign import ccall unsafe "streaming_commons_deflate_init2"     c_deflateInit2 :: ZStream' -> CInt -> CInt -> CInt -> CInt-                   -> IO ()+                   -> IO CInt  deflateInit2 :: ZStream' -> Int -> WindowBits -> Int -> Strategy -> IO ()-deflateInit2 zstream level windowBits memlevel strategy =+deflateInit2 zstream level windowBits memlevel strategy = void $     c_deflateInit2 zstream (fromIntegral level) (wbToInt windowBits)                    (fromIntegral memlevel)                    (fromIntegral $ fromEnum strategy)  foreign import ccall unsafe "streaming_commons_inflate_init2"-    c_inflateInit2 :: ZStream' -> CInt -> IO ()+    c_inflateInit2 :: ZStream' -> CInt -> IO CInt  inflateInit2 :: ZStream' -> WindowBits -> IO ()-inflateInit2 zstream wb = c_inflateInit2 zstream (wbToInt wb)+inflateInit2 zstream wb = void $ c_inflateInit2 zstream (wbToInt wb)  foreign import ccall unsafe "&streaming_commons_free_z_stream_inflate"     c_free_z_stream_inflate :: FunPtr (ZStream' -> IO ())@@ -94,10 +95,10 @@     c_call_deflate_full_flush :: ZStream' -> IO CInt  foreign import ccall unsafe "streaming_commons_deflate_set_dictionary"-    c_call_deflate_set_dictionary :: ZStream' -> Ptr CChar -> CUInt -> IO ()+    c_call_deflate_set_dictionary :: ZStream' -> Ptr CChar -> CUInt -> IO CInt  foreign import ccall unsafe "streaming_commons_inflate_set_dictionary"-    c_call_inflate_set_dictionary :: ZStream' -> Ptr CChar -> CUInt -> IO ()+    c_call_inflate_set_dictionary :: ZStream' -> Ptr CChar -> CUInt -> IO CInt  wbToInt :: WindowBits -> CInt wbToInt (WindowBits i) = fromIntegral i
streaming-commons.cabal view
@@ -1,5 +1,5 @@ name:                streaming-commons-version:             0.2.2.6+version:             0.2.3.0 synopsis:            Common lower-level functions needed by various streaming data libraries description:         Provides low-dependency functionality commonly needed by various streaming data libraries, such as conduit and pipes. homepage:            https://github.com/fpco/streaming-commons@@ -47,7 +47,7 @@                      , random                      , process                      , stm-                     , text >= 1.2 && < 1.3 || >= 2.0 && < 2.1+                     , text >= 1.2 && < 1.3 || >= 2.0 && < 2.2                      , transformers                      , zlib @@ -97,16 +97,16 @@     build-tool-depends:         hspec-discover:hspec-discover -  if flag(use-bytestring-builder)-    build-depends:     bytestring < 0.10.2.0-                     , bytestring-builder-  else-    build-depends:     bytestring >= 0.10.2.0+    if flag(use-bytestring-builder)+      build-depends:     bytestring < 0.10.2.0+                       , bytestring-builder+    else+      build-depends:     bytestring >= 0.10.2.0 -  if os(windows)-    cpp-options:       -DWINDOWS-  else-    build-depends:     unix+    if os(windows)+      cpp-options:       -DWINDOWS+    else+      build-depends:     unix  benchmark count-chars     default-language: Haskell2010@@ -143,11 +143,11 @@                   , deepseq                   , streaming-commons -  if flag(use-bytestring-builder)-    build-depends:     bytestring < 0.10.2.0-                     , bytestring-builder-  else-    build-depends:     bytestring >= 0.10.2.0+    if flag(use-bytestring-builder)+      build-depends:     bytestring < 0.10.2.0+                       , bytestring-builder+    else+      build-depends:     bytestring >= 0.10.2.0  source-repository head   type:     git