From 16fd0e268a17985c678a16bcd05a59f9484e8ba6 Mon Sep 17 00:00:00 2001 From: Alexander Vershilov Date: Mon, 2 Mar 2015 23:01:04 +0300 Subject: [PATCH] Fix getNodeStats function, see DP-97 --- src/Control/Distributed/Process/Internal/Primitives.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Control/Distributed/Process/Internal/Primitives.hs b/src/Control/Distributed/Process/Internal/Primitives.hs index 805e62db..ee3d4945 100644 --- a/src/Control/Distributed/Process/Internal/Primitives.hs +++ b/src/Control/Distributed/Process/Internal/Primitives.hs @@ -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)