@@ -30,7 +30,6 @@ import qualified Data.Map as Map
31 , filterWithKey
31 , filterWithKey
32 , foldlWithKey
32 , foldlWithKey
35import Data.Set (Set)
34import Data.Set (Set)
36import qualified Data.Set as Set
35import qualified Data.Set as Set
@@ -38,7 +37,6 @@ import qualified Data.Set as Set
44import Data.Foldable (forM_)
42import Data.Foldable (forM_)
@@ -71,9 +69,6 @@ import Control.Distributed.Process.Internal.CQueue
71 , newCQueue
69 , newCQueue
72 , mkWeakCQueue
70 , mkWeakCQueue
74−import qualified Control.Distributed.Process.Internal.CQueue as Mailbox
77import qualified Network.Transport as NT
72import qualified Network.Transport as NT
78 ( Transport
73 ( Transport
79 , EndPoint
74 , EndPoint
@@ -759,76 +754,43 @@ ncEffectGetInfo from pid =
759 let lpid = processLocalId pid
754 let lpid = processLocalId pid
760 them = (ProcessIdentifier pid)
755 them = (ProcessIdentifier pid)
762− liftIO . putStrLn $ "processing get info"
763 node <- ask
757 node <- ask
764− mProc <- liftIO $ withMVar (localState node) $ return . (^. localProcessWithId lpid)
759+ withMVar (localState node) $ return . (^. localProcessWithId lpid)
765 case mProc of
760 case mProc of
766 Nothing -> dispatch (isLocal node (ProcessIdentifier from))
761 Nothing -> dispatch (isLocal node (ProcessIdentifier from))
767 from node (ProcessInfoNone DiedUnknownId)
762 from node (ProcessInfoNone DiedUnknownId)
768− Just proc -> do
763+ Just _ -> do
769− liftIO . putStrLn $ "getting links"
770 itsLinks <- gets (^. linksFor them)
764 itsLinks <- gets (^. linksFor them)
771− liftIO . putStrLn $ "getting monitors"
772 itsMons <- gets (^. monitorsFor them)
765 itsMons <- gets (^. monitorsFor them)
773− liftIO . putStrLn $ "getting registered names"
774 registered <- gets (^. registeredHere)
766 registered <- gets (^. registeredHere)
776− (isLocal node (ProcessIdentifier from))
779− (Set.toList itsLinks)
780− (Set.toList itsMons)
781− (registeredNames registered)
783− where sendInfo :: ProcessId
788− -> [(ProcessId, MonitorRef)]
791− sendInfo d lc lp n l m r =
792− let n' = processNodeId pid
795− dispatch lc d n ProcessInfo {
797− , infoRegisteredNames = r
798− , infoMessageQueueLength = qLen
768+ let reg = registeredNames registered
769+ dispatch (isLocal node (ProcessIdentifier from))
773+ infoNode = (processNodeId pid)
774+ , infoRegisteredNames = reg
775+ -- we cannot populate this field
776+ , infoMessageQueueLength = Nothing
777+ , infoMonitors = Set.toList itsMons
778+ , infoLinks = Set.toList itsLinks
803− dispatch :: (Serializable a, Show a)
780+ where dispatch :: (Serializable a, Show a)
805 -> ProcessId
782 -> ProcessId
806 -> LocalNode
783 -> LocalNode
809− dispatch True dest _ pInfo = do
810− -- liftIO $ putStrLn $ "posting " ++ (show pInfo) ++ " to " ++ (show dest)
811− postAsMessage dest $ pInfo
786+ dispatch True dest _ pInfo = postAsMessage dest $ pInfo
812 dispatch False dest node pInfo = do
787 dispatch False dest node pInfo = do
813− -- liftIO $ putStrLn $ "posting pinfo to node of " ++ (show dest)
814 liftIO $ sendMessage node
788 liftIO $ sendMessage node
815 (NodeIdentifier (localNodeId node))
789 (NodeIdentifier (localNodeId node))
816 (ProcessIdentifier dest)
790 (ProcessIdentifier dest)
817 WithImplicitReconnect
791 WithImplicitReconnect
820− -- TODO: make this available to other functions?
821− qLength :: LocalProcess -> NC (Maybe Int)
823− liftIO $ putStrLn "getting qLen"
824− qRef <- liftIO $ deRefWeak (processWeakQ lp)
825− liftIO $ putStrLn "checking length..."
827− Nothing -> return $ Nothing
829− len <- liftIO $ Mailbox.length q
832 registeredNames = Map.foldlWithKey (\ks k v -> if v == pid
794 registeredNames = Map.foldlWithKey (\ks k v -> if v == pid
833 then (k:ks)
795 then (k:ks)
834 else ks) []
796 else ks) []
@@ -925,7 +887,6 @@ postAsMessage pid = postMessage pid . createMessage
926postMessage :: ProcessId -> Message -> NC ()
888postMessage :: ProcessId -> Message -> NC ()
927postMessage pid msg = do
889postMessage pid msg = do
928− liftIO $ putStrLn ("posting message to " ++ show pid)
929 withLocalProc pid $ \p -> enqueue (processQueue p) msg
890 withLocalProc pid $ \p -> enqueue (processQueue p) msg
931throwException :: Exception e => ProcessId -> e -> NC ()
892throwException :: Exception e => ProcessId -> e -> NC ()