wai-websockets 3.0.0.9 → 3.0.1
raw patch · 3 files changed
+11/−3 lines, 3 files
Files
- ChangeLog.md +4/−0
- Network/Wai/Handler/WebSockets.hs +6/−2
- wai-websockets.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+## 3.0.1++* Improved connection close logic+ ## 3.0.0.9 * Clean up stream resources when websockets completes [#549](https://github.com/yesodweb/wai/pull/549)
Network/Wai/Handler/WebSockets.hs view
@@ -7,7 +7,7 @@ , runWebSockets ) where -import Control.Exception (bracket)+import Control.Exception (bracket, tryJust) import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as BC import qualified Data.ByteString.Lazy as BL@@ -95,8 +95,12 @@ -> IO ByteString -> (ByteString -> IO ()) -> IO a-runWebSockets opts req app src sink = bracket mkStream WS.close (app . pc)+runWebSockets opts req app src sink = bracket mkStream ensureClose (app . pc) where+ ensureClose = tryJust onConnectionException . WS.close+ onConnectionException :: WS.ConnectionException -> Maybe ()+ onConnectionException WS.ConnectionClosed = Just ()+ onConnectionException _ = Nothing mkStream = WS.makeStream (do
wai-websockets.cabal view
@@ -1,5 +1,5 @@ Name: wai-websockets-Version: 3.0.0.9+Version: 3.0.1 Synopsis: Provide a bridge between WAI and the websockets package. License: MIT License-file: LICENSE