@@ -62,7 +62,7 @@ socketConnection :: Settings -> Socket -> IO Connection
62socketConnection set s = do
62socketConnection set s = do
63 bufferPool <- newBufferPool
63 bufferPool <- newBufferPool
64 writeBuf <- allocateBuffer bufferSize
64 writeBuf <- allocateBuffer bufferSize
65− let sendall = Sock.sendAll s
65+ let sendall = sendAll' s
66 isH2 <- newIORef False -- HTTP/1.x
66 isH2 <- newIORef False -- HTTP/1.x
67 return Connection {
67 return Connection {
68 connSendMany = Sock.sendMany s
68 connSendMany = Sock.sendMany s
@@ -87,6 +87,9 @@ socketConnection set s = do
87 , connBufferSize = bufferSize
87 , connBufferSize = bufferSize
88 , connHTTP2 = isH2
88 , connHTTP2 = isH2
91+ sendAll' sock bs = Sock.sendAll sock bs `E.catch` \(SomeException _) ->
92+ throwIO ConnectionClosedByPeer
91-- | Run an 'Application' on the given port.
94-- | Run an 'Application' on the given port.
92-- This calls 'runSettings' with 'defaultSettings'.
95-- This calls 'runSettings' with 'defaultSettings'.