on master help sign in
do not use useSocket in server example
commit1a60915d0b97855d2e3e153d7660d606b79ffa73 authorHarendra Kumar <harendra.kumar@gmail.com> dateSat 12 Oct 2019, 12:22 (7 years ago) parentedf9b36
2 files changed+5−2
examples/FileSinkServer.hs+4−2 streamly.cabal+1
examples/FileSinkServer.hs+4−2
@@ -5,11 +5,12 @@
55-- * lines from concurrent connections are merged into a single srteam
66-- * writes the line stream to an output file
77
8+import Control.Monad.IO.Class (liftIO)
9+import Network.Socket (close)
810import System.Environment (getArgs)
911
1012import Streamly
1113import Streamly.Data.String
12−import Streamly.Internal.Network.Socket (useSocket)
1314import qualified Streamly.FileSystem.Handle as FH
1415import qualified Streamly.Memory.Array as A
1516import qualified Streamly.Network.Socket as NS
@@ -25,11 +26,12 @@ main = do
2526 (\src -> S.fold (FH.write src)
2627 $ encodeChar8Unchecked
2728 $ S.concatUnfold A.read
28− $ S.concatMapWith parallel (flip useSocket recv)
29+ $ S.concatMapWith parallel use
2930 $ S.unfold NS.listenOnPort 8090)
3031
3132 where
3233
34+ use sk = S.finally (liftIO $ close sk) (recv sk)
3335 recv =
3436 S.splitWithSuffix (== '\n') A.write
3537 . decodeChar8
streamly.cabal+1
@@ -915,6 +915,7 @@ executable FileSinkServer
915915 build-Depends:
916916 streamly
917917 , base >= 4.8 && < 5
918+ , network >= 2.6 && < 4
918919 else
919920 buildable: False
920921