From a2246775616f1fad7f9bc7da48d162e3ef6114e4 Mon Sep 17 00:00:00 2001 From: Felix Paulusma Date: Thu, 4 Jan 2024 04:11:56 +0100 Subject: [PATCH] prevent thunks from building when calculating size in 'toBufWith' --- warp/Network/Wai/Handler/Warp/IO.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/warp/Network/Wai/Handler/Warp/IO.hs b/warp/Network/Wai/Handler/Warp/IO.hs index 9cc83d8cc..a25e130f3 100644 --- a/warp/Network/Wai/Handler/Warp/IO.hs +++ b/warp/Network/Wai/Handler/Warp/IO.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE BangPatterns #-} module Network.Wai.Handler.Warp.IO where import Control.Exception (mask_) @@ -19,7 +20,7 @@ toBufIOWith maxRspBufSize writeBufferRef io builder = do size = bufSize writeBuffer (len, signal) <- writer buf size bufferIO buf len io - let totalBytesSent = toInteger len + bytesSent + let !totalBytesSent = toInteger len + bytesSent case signal of Done -> return totalBytesSent More minSize next