Skip to content

Commit

Permalink
Style
Browse files Browse the repository at this point in the history
  • Loading branch information
bolt12 committed Mar 2, 2023
1 parent 84d01cf commit eda5af2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 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
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ import qualified Test.Ouroboros.Network.PeerSelection.RootPeersDNS as PeerSelect
import Test.Ouroboros.Network.PeerSelection.RootPeersDNS
(DNSLookupDelay (..), DNSTimeout (..))

import Test.QuickCheck
import Control.Monad.Class.MonadMVar (MonadMVar)
import Ouroboros.Network.PeerSelection.PeerAdvertise.Type
(PeerAdvertise (..))
import Ouroboros.Network.PeerSelection.PeerSharing.Type (PeerSharing)
import Control.Monad.Class.MonadMVar (MonadMVar)
import Ouroboros.Network.Protocol.PeerSharing.Codec
(byteLimitsPeerSharing, timeLimitsPeerSharing)
import Test.QuickCheck

-- | Diffusion Simulator Arguments
--
Expand Down Expand Up @@ -158,15 +158,15 @@ data NodeArgs =
, naDiffusionMode :: DiffusionMode
, naMbTime :: Maybe DiffTime
-- ^ 'LimitsAndTimeouts' argument
, naRelays :: Map RelayAccessPoint PeerAdvertise
, naRelays :: Map RelayAccessPoint PeerAdvertise
-- ^ 'Interfaces' relays auxiliary value
, naDomainMap :: Map Domain [IP]
-- ^ 'Interfaces' 'iDomainMap' value
, naAddr :: NtNAddr
-- ^ 'Arguments' 'aIPAddress' value
, naPeerSharing :: PeerSharing
, naPeerSharing :: PeerSharing
-- ^ 'Arguments' 'aIPAddress' value
, naLocalRootPeers :: [(Int, Map RelayAccessPoint PeerAdvertise)]
, naLocalRootPeers :: [(Int, Map RelayAccessPoint PeerAdvertise)]
-- ^ 'Arguments' 'LocalRootPeers' values
, naLocalSelectionTargets :: PeerSelectionTargets
-- ^ 'Arguments' 'aLocalSelectionTargets' value
Expand Down

0 comments on commit eda5af2

Please sign in to comment.