Skip to content

Commit

Permalink
Style
Browse files Browse the repository at this point in the history
  • Loading branch information
bolt12 committed Feb 8, 2023
1 parent 4b5a9d5 commit e8fa78d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ deletePeers :: Ord peeraddr
=> Set peeraddr
-> EstablishedPeers peeraddr peerconn
-> EstablishedPeers peeraddr peerconn
deletePeers peeraddrs es@EstablishedPeers { allPeers
, availableForPeerShare
, nextPeerShareTimes
, nextActivateTimes
deletePeers peeraddrs es@EstablishedPeers { allPeers,
availableForPeerShare,
nextPeerShareTimes,
nextActivateTimes
} =
es { allPeers = Map.withoutKeys allPeers peeraddrs,
availableForPeerShare = Set.difference availableForPeerShare peeraddrs,
Expand All @@ -226,10 +226,10 @@ setCurrentTime now ep@EstablishedPeers { nextPeerShareTimes
, nextActivateTimes
}
-- Efficient check for the common case of there being nothing to do:
| Just (Min t) <- (f <$> PSQ.minView nextPeerShareTimes)
<> (f <$> PSQ.minView nextActivateTimes)
, t > now
= ep
| Just (Min t) <- (f <$> PSQ.minView nextPeerShareTimes)
<> (f <$> PSQ.minView nextActivateTimes)
, t > now
= ep
where
f (_,t,_,_) = Min t

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ belowTarget actions
= Guarded Nothing $ do
-- Max selected should be <= numPeerShareReqsPossible
selectedForPeerShare <- pickPeers st
policyPickKnownPeersForPeerShare
canAsk
numPeerShareReqsPossible
policyPickKnownPeersForPeerShare
canAsk
numPeerShareReqsPossible

let -- Should be <= numPeerShareReqsPossible
numPeerShareReqs = Set.size selectedForPeerShare
Expand Down Expand Up @@ -143,12 +143,12 @@ jobPeerShare PeerSelectionActions{requestPeerShare}
handler :: [peeraddr] -> SomeException -> m (Completion m peeraddr peerconn)
handler peers e = return $
Completion $ \st _ ->
Decision { decisionTrace = [TracePeerShareResults [ (p, Left e) | p <- peers ]]
, decisionState =
Decision { decisionTrace = [TracePeerShareResults [ (p, Left e) | p <- peers ]],
decisionState =
st { inProgressPeerShareReqs = inProgressPeerShareReqs st
- length peers
}
, decisionJobs = []
},
decisionJobs = []
}

jobPhase1 :: [(PeerSharingAmount, peeraddr)] -> m (Completion m peeraddr peerconn)
Expand Down

0 comments on commit e8fa78d

Please sign in to comment.