Skip to content

Commit c67b972

Browse files
Have nsendRemote skip the transport for local communication.
1 parent deadc44 commit c67b972

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Control/Distributed/Process/Internal/Primitives.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,8 +1173,10 @@ unsafeNSend = Unsafe.nsend
11731173

11741174
-- | Named send to a process in a remote registry (asynchronous)
11751175
nsendRemote :: Serializable a => NodeId -> String -> a -> Process ()
1176-
nsendRemote nid label msg =
1177-
sendCtrlMsg (Just nid) (NamedSend label (createMessage msg))
1176+
nsendRemote nid label msg = do
1177+
here <- getSelfNode
1178+
if here == nid then nsend label msg
1179+
else sendCtrlMsg (Just nid) (NamedSend label (createMessage msg))
11781180

11791181
--------------------------------------------------------------------------------
11801182
-- Closures --

0 commit comments

Comments
 (0)