Skip to content

Commit

Permalink
Fix getNodeStats function, see DP-97
Browse files Browse the repository at this point in the history
  • Loading branch information
qnikst committed Mar 2, 2015
1 parent 4d3472a commit 16fd0e2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Control/Distributed/Process/Internal/Primitives.hs
Expand Up @@ -757,11 +757,11 @@ getNodeStats nid = do
selfNode <- getSelfNode
if nid == selfNode
then Right `fmap` getLocalNodeStats -- optimisation
else getNodeStatsRemote
else getNodeStatsRemote selfNode
where
getNodeStatsRemote :: Process (Either DiedReason NodeStats)
getNodeStatsRemote = do
sendCtrlMsg (Just nid) $ GetNodeStats nid
getNodeStatsRemote :: NodeId -> Process (Either DiedReason NodeStats)
getNodeStatsRemote selfNode = do
sendCtrlMsg (Just nid) $ GetNodeStats selfNode
bracket (monitorNode nid) unmonitor $ \mRef ->
receiveWait [ match (\(stats :: NodeStats) -> return $ Right stats)
, matchIf (\(NodeMonitorNotification ref _ _) -> ref == mRef)
Expand Down

0 comments on commit 16fd0e2

Please sign in to comment.