@@ -45,6 +45,7 @@ module Control.Distributed.Process.UnsafePrimitives
46 , sendChan
46 , sendChan
48 , wrapMessage
49 , wrapMessage
@@ -65,6 +66,7 @@ import Control.Distributed.Process.Internal.Types
65 , ImplicitReconnect(..)
66 , ImplicitReconnect(..)
66 , SendPortId(..)
67 , SendPortId(..)
68 , sendPortProcessId
70 , sendPortProcessId
69 , unsafeCreateUnencodedMessage
71 , unsafeCreateUnencodedMessage
@@ -96,6 +98,25 @@ send them msg = do
96 unsafeSendLocal pid msg' =
98 unsafeSendLocal pid msg' =
97 sendCtrlMsg Nothing $ LocalSend pid (unsafeCreateUnencodedMessage msg')
99 sendCtrlMsg Nothing $ LocalSend pid (unsafeCreateUnencodedMessage msg')
101+-- | Send a message unreliably.
103+-- Unlike 'send', this function is insensitive to 'reconnect'. It will
104+-- try to send the message regardless of the history of connection failures
105+-- between the nodes.
107+-- Message passing with 'usend' is ordered for a given sender and receiver
108+-- if the messages arrive at all.
110+usend :: Serializable a => ProcessId -> a -> Process ()
113+ let there = processNodeId them
114+ if localNodeId (processNode proc) == there
115+ then sendCtrlMsg Nothing $
116+ LocalSend them (unsafeCreateUnencodedMessage msg)
117+ else sendCtrlMsg (Just there) $ UnreliableSend (processLocalId them)
99-- | Send a message on a typed channel
120-- | Send a message on a typed channel
100sendChan :: Serializable a => SendPort a -> a -> Process ()
121sendChan :: Serializable a => SendPort a -> a -> Process ()
101sendChan (SendPort cid) msg = do
122sendChan (SendPort cid) msg = do