udp-streaming 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+5/−9 lines, 2 files
Files
- src/Streaming/UDP.hs +3/−7
- udp-streaming.cabal +2/−2
src/Streaming/UDP.hs view
@@ -38,13 +38,9 @@ -- | Stream all incoming data to the given connected 'Socket'. Note that this function will -- not automatically close the 'Socket' when processing completes. toSocket :: (MonadIO m) => Socket -> Stream (Of ByteString) m r -> m r-toSocket s = loop . S.next- where- loop :: (MonadIO m) => m (Either r (ByteString, Stream (Of ByteString) m r)) -> m r- loop m = m >>= either return loop'- loop' :: MonadIO m => (ByteString, Stream (Of ByteString) m r) -> m r- loop' (msg, str') = liftIO (send s msg) >> (loop $ S.next str')- -- since we are sending a datagram, can't use sendAll; ignore the value returned by send+toSocket s = S.mapM_ $ liftIO . send s+ -- since we are sending a datagram, can't use sendAll; ignore the value returned by send+ -- | An alternative to 'toSocket'. Instead of taking a pre-opened 'Socket', it -- takes an action that returns a connected 'Socket' , so that it can open it
udp-streaming.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 7e911d679bae02bfce07a28bc4e8d4e264414212bd4957071ee7f7b7779de1c4+-- hash: fe0af0b6e00f4017f468ad1df7906de71eb634f5215bb20cd40c0a7364247174 name: udp-streaming-version: 0.1.0.0+version: 0.1.0.1 synopsis: Simple fire-and-forget udp Streaming components modelled after udp-conduit category: Network, Streaming stability: experimental