14
14
{-# LANGUAGE OverloadedRecordDot #-}
15
15
{-# LANGUAGE PolyKinds #-}
16
16
{-# LANGUAGE RankNTypes #-}
17
+ {-# LANGUAGE RecordWildCards #-}
17
18
{-# LANGUAGE ScopedTypeVariables #-}
18
19
{-# LANGUAGE StandaloneDeriving #-}
19
20
{-# LANGUAGE StandaloneKindSignatures #-}
@@ -440,16 +441,16 @@ relayProducer config sst = TC.Yield MsgInit $ idle initRelayProducerLocalState
440
441
when (expand. value == 0 && (isBlocking blocking || shrink. value == 0 )) $ do
441
442
throw $ RequestedNoChange (isBlocking blocking) shrink expand
442
443
-- Shrink the window:
443
- let keptValues = Seq. drop (fromIntegral shrink) lst. window
444
+ let ! keptValues = Seq. drop (fromIntegral shrink) lst. window
444
445
-- Find the new entries:
445
446
newEntries <- readNewEntries sst blocking expand lst. lastTicket
446
447
-- Expand the window:
447
- let newValues = Seq. fromList [(e . key, e . ticket) | e <- Foldable. toList newEntries]
448
+ let newValues = Seq. fromList [(key, ticket) | RB. EntryWithTicket { .. } <- Foldable. toList newEntries]
448
449
let window' = keptValues <> newValues
449
450
let lastTicket' = case newValues of
450
451
Seq. Empty -> lst. lastTicket
451
452
_ Seq. :|> (_, ticket) -> ticket
452
- let lst' = lst{window = window', lastTicket = lastTicket'}
453
+ let ! lst' = lst{window = window', lastTicket = lastTicket'}
453
454
let responseList = fmap (fst . (. value)) newEntries
454
455
-- Yield the new entries:
455
456
withSingIBlockingStyle blocking $ do
@@ -547,7 +548,7 @@ runRelayConsumer config sst chan =
547
548
-- implementation.
548
549
type RelayConsumerLocalState :: Type -> Type -> Type -> N -> Type
549
550
data RelayConsumerLocalState id header body n = RelayConsumerLocalState
550
- { pendingRequests :: Nat n
551
+ { pendingRequests :: ! ( Nat n )
551
552
, pendingExpand :: ! WindowExpand
552
553
-- ^ The number of headers that we have requested but
553
554
-- which have not yet been replied to. We need to track this it keep
@@ -711,7 +712,7 @@ relayConsumerPipelined config sst =
711
712
-- It's important not to pipeline more requests for headers when we
712
713
-- have no bodies to ask for, since (with no other guard) this will
713
714
-- put us into a busy-polling loop.
714
- let lst' = lst0{pendingRequests = pendingRequests'}
715
+ let ! lst' = lst0{pendingRequests = pendingRequests'}
715
716
716
717
-- Note: the peer will proceed with only one of the two
717
718
-- arguments of Collect, depending on whether responses are
@@ -720,7 +721,7 @@ relayConsumerPipelined config sst =
720
721
Left lst -> do
721
722
-- In this case there is nothing else to do so we block until we
722
723
-- collect a reply.
723
- let lst' = lst{pendingRequests = pendingRequests'}
724
+ let ! lst' = lst{pendingRequests = pendingRequests'}
724
725
return $ TS. Collect Nothing (handleResponse lst')
725
726
726
727
done ::
@@ -783,7 +784,7 @@ relayConsumerPipelined config sst =
783
784
else do
784
785
let available2 = Map. withoutKeys lst. available idsToRequestSet
785
786
modifyTVar' sst. inFlightVar $ Set. union idsToRequestSet
786
- let ! lst2 = lst{pendingRequests = Succ lst. pendingRequests, available = available2}
787
+ let ! lst2 = lst{pendingRequests = Succ $! lst. pendingRequests, available = available2}
787
788
return $
788
789
TS. YieldPipelined
789
790
(MsgRequestBodies idsToRequest)
0 commit comments