@@ -1112,8 +1112,10 @@ registerImpl force label pid = do
11121112--
11131113-- See comments in 'whereisRemoteAsync'
11141114registerRemoteAsync :: NodeId -> String -> ProcessId -> Process ()
1115−registerRemoteAsync nid label pid =
1116− sendCtrlMsg (Just nid) (Register label nid (Just pid) False)
1115+registerRemoteAsync nid label pid = do
1116+ here <- getSelfNode
1117+ sendCtrlMsg (if nid == here then Nothing else Just nid)
1118+ (Register label nid (Just pid) False)
11171119
11181120reregisterRemoteAsync :: NodeId -> String -> ProcessId -> Process ()
11191121reregisterRemoteAsync nid label pid =
@@ -1165,8 +1167,9 @@ whereis label = do
11651167-- use 'monitorNode' and take appropriate action when you receive a
11661168-- 'NodeMonitorNotification').
11671169whereisRemoteAsync :: NodeId -> String -> Process ()
1168−whereisRemoteAsync nid label =
1169− sendCtrlMsg (Just nid) (WhereIs label)
1170+whereisRemoteAsync nid label = do
1171+ here <- getSelfNode
1172+ sendCtrlMsg (if nid == here then Nothing else Just nid) (WhereIs label)
11701173
11711174-- | Named send to a process in the local registry (asynchronous)
11721175nsend :: Serializable a => String -> a -> Process ()
@@ -1182,8 +1185,10 @@ unsafeNSend = Unsafe.nsend
11821185
11831186-- | Named send to a process in a remote registry (asynchronous)
11841187nsendRemote :: Serializable a => NodeId -> String -> a -> Process ()
1185−nsendRemote nid label msg =
1186− sendCtrlMsg (Just nid) (NamedSend label (createMessage msg))
1188+nsendRemote nid label msg = do
1189+ here <- getSelfNode
1190+ if here == nid then nsend label msg
1191+ else sendCtrlMsg (Just nid) (NamedSend label (createMessage msg))
11871192
11881193-- | Named send to a process in a remote registry (asynchronous)
11891194-- This function makes /no/ attempt to serialize and (in the case when the