@@ -62,7 +62,7 @@ socketConnection :: Settings -> Socket -> IO Connection
6262socketConnection set s = do
6363 bufferPool <- newBufferPool
6464 writeBuf <- allocateBuffer bufferSize
65− let sendall = Sock.sendAll s
65+ let sendall = sendAll' s
6666 isH2 <- newIORef False -- HTTP/1.x
6767 return Connection {
6868 connSendMany = Sock.sendMany s
@@ -87,6 +87,9 @@ socketConnection set s = do
8787 , connBufferSize = bufferSize
8888 , connHTTP2 = isH2
8989 }
90+ where
91+ sendAll' sock bs = Sock.sendAll sock bs `E.catch` \(SomeException _) ->
92+ throwIO ConnectionClosedByPeer
9093
9194-- | Run an 'Application' on the given port.
9295-- This calls 'runSettings' with 'defaultSettings'.