From eda5af295bc2f52e4a5e9b454b84da0efeef5839 Mon Sep 17 00:00:00 2001 From: Armando Santos Date: Fri, 20 Jan 2023 15:20:22 +0000 Subject: [PATCH] Style --- .../Network/PeerSelection/EstablishedPeers.hs | 16 ++++++++-------- .../Network/PeerSelection/Governor/KnownPeers.hs | 14 +++++++------- .../Ouroboros/Network/Testnet/Simulation/Node.hs | 10 +++++----- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ouroboros-network/src/Ouroboros/Network/PeerSelection/EstablishedPeers.hs b/ouroboros-network/src/Ouroboros/Network/PeerSelection/EstablishedPeers.hs index abeeab3a81e..403b4dce945 100644 --- a/ouroboros-network/src/Ouroboros/Network/PeerSelection/EstablishedPeers.hs +++ b/ouroboros-network/src/Ouroboros/Network/PeerSelection/EstablishedPeers.hs @@ -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, @@ -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 diff --git a/ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor/KnownPeers.hs b/ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor/KnownPeers.hs index 918c3b276d0..fed8fc31328 100644 --- a/ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor/KnownPeers.hs +++ b/ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor/KnownPeers.hs @@ -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 @@ -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) diff --git a/ouroboros-network/test/Test/Ouroboros/Network/Testnet/Simulation/Node.hs b/ouroboros-network/test/Test/Ouroboros/Network/Testnet/Simulation/Node.hs index c72db9e6426..3d2444a41e9 100644 --- a/ouroboros-network/test/Test/Ouroboros/Network/Testnet/Simulation/Node.hs +++ b/ouroboros-network/test/Test/Ouroboros/Network/Testnet/Simulation/Node.hs @@ -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 -- @@ -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