From 2136b30a030a6e8ed56ff2487a4d6fc860d3a10b Mon Sep 17 00:00:00 2001 From: joe Date: Sun, 30 Jun 2013 14:23:47 -0400 Subject: SocketC now exports packetSink --- Presence/ServerC.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Presence/ServerC.hs b/Presence/ServerC.hs index b16a0099..22104a31 100644 --- a/Presence/ServerC.hs +++ b/Presence/ServerC.hs @@ -8,6 +8,7 @@ module ServerC , ServerHandle , quitListening , dummyServerHandle + , packetSink ) where import Network.Socket as Socket @@ -123,13 +124,13 @@ packets h = do where getPacket h = do { hWaitForInput h (-1) ; hGetNonBlocking h 1024 } -outgoing :: MonadIO m => Handle -> Sink S.ByteString m () -outgoing h = do +packetSink :: MonadIO m => Handle -> Sink S.ByteString m () +packetSink h = do -- liftIO . L.putStrLn $ "outgoing: waiting" mpacket <- await -- liftIO . L.putStrLn $ "outgoing: got packet " <++> bshow mpacket maybe (return ()) - (\r -> (liftIO . S.hPutStrLn h $ r) >> outgoing h) + (\r -> (liftIO . S.hPutStrLn h $ r) >> packetSink h) mpacket @@ -148,5 +149,5 @@ runConn g st (sock,_) = do h <- socketToHandle sock ReadWriteMode hSetBuffering h NoBuffering let doException (SomeException e) = Prelude.putStrLn ("\n\nexception: " ++ show e ++ "\n\n") - handle doException (g (restrictSocket sock `HCons` st) (packets h) (outgoing h)) + handle doException (g (restrictSocket sock `HCons` st) (packets h) (packetSink h)) hClose h -- cgit v1.2.3