@@ -339,10 +339,8 @@ nodeController = forever $ do
340 -- Forward the message if appropriate
340 -- Forward the message if appropriate
341 case destNid (ctrlMsgSignal msg) of
341 case destNid (ctrlMsgSignal msg) of
342− Just nid' | nid' /= localNodeId node ->
342+ Just nid' | nid' /= localNodeId node -> ncSendCtrlMsg nid' msg
343− ctrlSendTo (Right nid') . BSL.toChunks . encode $ msg
345− return ()
343+ _ -> return ()
347 processCtrlMsg msg
345 processCtrlMsg msg
@@ -365,6 +363,9 @@ ctrlSendTo them payload = do
365 , ctrlMsgSignal = Died them DiedDisconnect
363 , ctrlMsgSignal = Died them DiedDisconnect
366+ncSendCtrlMsg :: NodeId -> NodeCtrlMsg -> NodeCtrl ()
367+ncSendCtrlMsg dest = ctrlSendTo (Right dest) . BSL.toChunks . encode
368ctrlSendLocal :: LocalProcessId -> Message -> NodeCtrl ()
369ctrlSendLocal :: LocalProcessId -> Message -> NodeCtrl ()
369ctrlSendLocal lpid msg = do
370ctrlSendLocal lpid msg = do
370 node <- ask
371 node <- ask
@@ -425,6 +426,11 @@ processCtrlMsg (NodeCtrlMsg (Left from) (Monitor them ref)) = do
425 (False, True) -> -- [Unified: second rule]
426 (False, True) -> -- [Unified: second rule]
426 ctrlSendLocal (processLocalId from) . createMessage $
427 ctrlSendLocal (processLocalId from) . createMessage $
427 ProcessDied ref them DiedNoProc
428 ProcessDied ref them DiedNoProc
429+ (False, False) -> -- [Unified: third rule]
430+ ncSendCtrlMsg (processNodeId from) $ NodeCtrlMsg
431+ { ctrlMsgSender = Right (localNodeId node)
432+ , ctrlMsgSignal = Died (Left them) DiedNoProc
429processCtrlMsg (NodeCtrlMsg (Right _) (Monitor _ _)) =
435processCtrlMsg (NodeCtrlMsg (Right _) (Monitor _ _)) =
430 error "Monitor message from a node?"
436 error "Monitor message from a node?"
@@ -466,11 +472,10 @@ processCtrlMsg (NodeCtrlMsg _from (Died (Left pid) reason)) = do
467 ctrlSendLocal (processLocalId us) msg
473 ctrlSendLocal (processLocalId us) msg
469− ctrlSendTo (Right . processNodeId $ us) . BSL.toChunks . encode $
470− NodeCtrlMsg
475+ ncSendCtrlMsg (processNodeId us) $ NodeCtrlMsg
471− { ctrlMsgSender = Right (localNodeId node) -- TODO: why the change in sender? How does that affect 'reconnect' semantics?
476+ { ctrlMsgSender = Right (localNodeId node) -- TODO: why the change in sender? How does that affect 'reconnect' semantics?
472− , ctrlMsgSignal = Died (Left pid) reason
477+ , ctrlMsgSignal = Died (Left pid) reason
475 modify $ (nodeCtrlLinksForProcess pid ^= Set.empty)
480 modify $ (nodeCtrlLinksForProcess pid ^= Set.empty)
476 . (nodeCtrlMonsForProcess pid ^= Map.empty)
481 . (nodeCtrlMonsForProcess pid ^= Map.empty)