websockets-snap 0.9.1.0 → 0.9.2.0
raw patch · 3 files changed
+23/−18 lines, 3 filesdep ~websocketsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: websockets
API changes (from Hackage documentation)
Files
- CHANGELOG +3/−0
- src/Network/WebSockets/Snap.hs +12/−10
- websockets-snap.cabal +8/−8
CHANGELOG view
@@ -1,3 +1,6 @@+- 0.9.2.0+ * Bump websockets to 0.9.5.0 to fix socket closing issues+ - 0.9.1.0 * Fixed interleaved messages issue
src/Network/WebSockets/Snap.hs view
@@ -10,10 +10,10 @@ -------------------------------------------------------------------------------- import Control.Concurrent (forkIO, myThreadId, threadDelay) import Control.Concurrent.MVar (MVar, newEmptyMVar, putMVar,- takeMVar, newMVar)+ takeMVar) import Control.Exception (Exception (..),- SomeException (..), handle,- throw, throwTo)+ SomeException (..), finally,+ handle, throwIO, throwTo) import Control.Monad (forever) import Control.Monad.Trans (lift) import Data.ByteString (ByteString)@@ -82,7 +82,7 @@ case chunk of Chunk x -> return (Just x) Eof -> return Nothing- Error (SomeException e) -> throw e+ Error (SomeException e) -> throwIO e --------------------------------------------------------------------------------@@ -90,19 +90,19 @@ :: E.Iteratee ByteString IO () -> IO (Maybe BL.ByteString -> IO ()) copyStreamToIteratee iteratee0 = do- ref <- newMVar =<< E.runIteratee iteratee0+ ref <- newIORef =<< E.runIteratee iteratee0 return (go ref) where go _ Nothing = return () go ref (Just bl) = do- step <- takeMVar ref+ step <- readIORef ref case step of E.Continue f -> do let chunks = BL.toChunks bl step' <- E.runIteratee $ f $ E.Chunks chunks- putMVar ref step'- E.Yield () _ -> putMVar ref step >> throw WS.ConnectionClosed- E.Error (SomeException e) -> putMVar ref step >> throw e+ writeIORef ref step'+ E.Yield () _ -> throwIO WS.ConnectionClosed+ E.Error (SomeException e) -> throwIO e --------------------------------------------------------------------------------@@ -147,7 +147,9 @@ , WS.pendingStream = stream } - _ <- lift $ forkIO $ app pc >> throwTo thisThread ServerAppDone+ _ <- lift $ forkIO $ finally (app pc) $ do+ WS.close stream+ throwTo thisThread ServerAppDone copyIterateeToMVar tickle mvar
websockets-snap.cabal view
@@ -1,5 +1,5 @@ Name: websockets-snap-Version: 0.9.1.0+Version: 0.9.2.0 Synopsis: Snap integration for the websockets library Description: Snap integration for the websockets library License: BSD3@@ -21,13 +21,13 @@ Network.WebSockets.Snap Build-depends:- base >= 4 && < 5,- bytestring >= 0.9 && < 0.11,- enumerator >= 0.4 && < 0.5,- mtl >= 2.1 && < 2.3,- snap-core >= 0.8 && < 0.10,- snap-server >= 0.8 && < 0.10,- websockets >= 0.9 && < 0.10+ base >= 4 && < 5,+ bytestring >= 0.9 && < 0.11,+ enumerator >= 0.4 && < 0.5,+ mtl >= 2.1 && < 2.3,+ snap-core >= 0.8 && < 0.10,+ snap-server >= 0.8 && < 0.10,+ websockets >= 0.9.5 && < 0.10 Source-repository head Type: git