@@ -122,7 +122,7 @@ import Control.Distributed.Process.Internal.Messaging
122 ( sendBinary
122 ( sendBinary
123 , sendMessage
123 , sendMessage
124 , sendPayload
124 , sendPayload
125− , reconnect
125+ , ImplicitReconnect(WithImplicitReconnect, NoImplicitReconnect)
127import Control.Distributed.Process.Internal.Primitives (expect, register, finally)
127import Control.Distributed.Process.Internal.Primitives (expect, register, finally)
128import qualified Control.Distributed.Process.Internal.Closure.BuiltIn as BuiltIn (remoteTable)
128import qualified Control.Distributed.Process.Internal.Closure.BuiltIn as BuiltIn (remoteTable)
@@ -422,6 +422,7 @@ nodeController = do
422 liftIO $ sendBinary node
422 liftIO $ sendBinary node
423 (ctrlMsgSender msg)
423 (ctrlMsgSender msg)
424 (NodeIdentifier nid')
424 (NodeIdentifier nid')
425+ WithImplicitReconnect
427 return ()
428 return ()
@@ -445,8 +446,6 @@ nodeController = do
445 ncEffectWhereIs from label
446 ncEffectWhereIs from label
446 NCMsg from (NamedSend label msg') ->
447 NCMsg from (NamedSend label msg') ->
447 ncEffectNamedSend from label msg'
448 ncEffectNamedSend from label msg'
448− NCMsg from (Reconnect to) ->
449− ncEffectReconnect from to
450 unexpected ->
449 unexpected ->
451 error $ "nodeController: unexpected message " ++ show unexpected
450 error $ "nodeController: unexpected message " ++ show unexpected
@@ -475,6 +474,7 @@ ncEffectMonitor from them mRef = do
475 liftIO $ sendBinary node
474 liftIO $ sendBinary node
476 (NodeIdentifier $ localNodeId node)
475 (NodeIdentifier $ localNodeId node)
477 (NodeIdentifier $ processNodeId from)
476 (NodeIdentifier $ processNodeId from)
477+ WithImplicitReconnect
479 { ctrlMsgSender = NodeIdentifier (localNodeId node)
479 { ctrlMsgSender = NodeIdentifier (localNodeId node)
480 , ctrlMsgSignal = Died them DiedUnknownId
480 , ctrlMsgSignal = Died them DiedUnknownId
@@ -537,6 +537,7 @@ ncEffectSpawn pid cProc ref = do
537 liftIO $ sendMessage node
537 liftIO $ sendMessage node
538 (NodeIdentifier (localNodeId node))
538 (NodeIdentifier (localNodeId node))
539 (ProcessIdentifier pid)
539 (ProcessIdentifier pid)
540+ WithImplicitReconnect
540 (DidSpawn ref pid')
541 (DidSpawn ref pid')
542-- Unified semantics does not explicitly describe how to implement 'register',
543-- Unified semantics does not explicitly describe how to implement 'register',
@@ -556,6 +557,7 @@ ncEffectWhereIs from label = do
556 liftIO $ sendMessage node
557 liftIO $ sendMessage node
557 (NodeIdentifier (localNodeId node))
558 (NodeIdentifier (localNodeId node))
558 (ProcessIdentifier from)
559 (ProcessIdentifier from)
560+ WithImplicitReconnect
559 (WhereIsReply label mPid)
561 (WhereIsReply label mPid)
561-- [Unified: Table 14]
563-- [Unified: Table 14]
@@ -568,14 +570,9 @@ ncEffectNamedSend from label msg = do
568 liftIO $ sendPayload node
570 liftIO $ sendPayload node
570 (ProcessIdentifier pid)
572 (ProcessIdentifier pid)
571 (messageToPayload msg)
574 (messageToPayload msg)
574−ncEffectReconnect :: Identifier -> Identifier -> NC ()
575−ncEffectReconnect from to = do
577− liftIO $ reconnect node from to
579--------------------------------------------------------------------------------
576--------------------------------------------------------------------------------
580-- Auxiliary --
577-- Auxiliary --
581--------------------------------------------------------------------------------
578--------------------------------------------------------------------------------
@@ -601,11 +598,11 @@ notifyDied dest src reason mRef = do
601 (True, Nothing, SendPortIdentifier pid) ->
598 (True, Nothing, SendPortIdentifier pid) ->
602 throwException dest $ PortLinkException pid reason
599 throwException dest $ PortLinkException pid reason
603 (False, _, _) ->
600 (False, _, _) ->
604− -- TODO: why the change in sender? How does that affect 'reconnect' semantics?
605− -- (see [Unified: Table 10]
601+ -- The change in sender comes from [Unified: Table 10]
606 liftIO $ sendBinary node
602 liftIO $ sendBinary node
607 (NodeIdentifier $ localNodeId node)
603 (NodeIdentifier $ localNodeId node)
608 (NodeIdentifier $ processNodeId dest)
604 (NodeIdentifier $ processNodeId dest)
605+ WithImplicitReconnect
610 { ctrlMsgSender = NodeIdentifier (localNodeId node)
607 { ctrlMsgSender = NodeIdentifier (localNodeId node)
611 , ctrlMsgSignal = Died src reason
608 , ctrlMsgSignal = Died src reason
@@ -621,7 +618,6 @@ destNid (Spawn _ _) = Nothing
621destNid (Register _ _) = Nothing
618destNid (Register _ _) = Nothing
622destNid (WhereIs _) = Nothing
619destNid (WhereIs _) = Nothing
623destNid (NamedSend _ _) = Nothing
620destNid (NamedSend _ _) = Nothing
624−destNid (Reconnect _) = Nothing
625-- We don't need to forward 'Died' signals; if monitoring/linking is setup,
621-- We don't need to forward 'Died' signals; if monitoring/linking is setup,
626-- then when a local process dies the monitoring/linking machinery will take
622-- then when a local process dies the monitoring/linking machinery will take
627-- care of notifying remote nodes
623-- care of notifying remote nodes
@@ -721,10 +717,12 @@ registryFor ident = registry >>> DAC.mapMaybe ident
722-- * the notifications for that process specifically and
718-- * the notifications for that process specifically and
723-- * the notifications for typed channels to that process.
719-- * the notifications for typed channels to that process.
721+-- See https://github.com/haskell/containers/issues/14 for the bang on _v.
724splitNotif :: Identifier
722splitNotif :: Identifier
725 -> Map Identifier a
723 -> Map Identifier a
726 -> (Map Identifier a, Map Identifier a)
724 -> (Map Identifier a, Map Identifier a)
727−splitNotif ident = Map.partitionWithKey (\k !v -> impliesDeathOf ident k)
725+splitNotif ident = Map.partitionWithKey (\k !_v -> impliesDeathOf ident k)
729-- | Does the death of one entity (node, project, channel) imply the death
727-- | Does the death of one entity (node, project, channel) imply the death
730-- of another?
728-- of another?