on master help sign in
Throw ConnectionClosedByPeer exception if the client closed the connection (like in warp-tls)
commitb16c40ca47bade6314e3ad28d6e6fc62dfd8cdb3 authorGiorgio Marinelli <giorgio@marinel.li> dateThu 20 Feb 2020, 18:02 (7 years ago) parent2b07b8f
1 file changed+4−1
warp/Network/Wai/Handler/Warp/Run.hs+4−1
warp/Network/Wai/Handler/Warp/Run.hs+4−1
@@ -55,7 +55,7 @@ socketConnection :: Socket -> IO Connection
5555socketConnection s = do
5656 bufferPool <- newBufferPool
5757 writeBuf <- allocateBuffer bufferSize
58− let sendall = Sock.sendAll s
58+ let sendall = sendAll' s
5959 return Connection {
6060 connSendMany = Sock.sendMany s
6161 , connSendAll = sendall
@@ -67,6 +67,9 @@ socketConnection s = do
6767 , connWriteBuffer = writeBuf
6868 , connBufferSize = bufferSize
6969 }
70+ where
71+ sendAll' sock bs = Sock.sendAll sock bs `E.catch` \(SomeException _) ->
72+ throwIO ConnectionClosedByPeer
7073
7174-- | Run an 'Application' on the given port.
7275-- This calls 'runSettings' with 'defaultSettings'.