@@ -47,6 +47,7 @@ module Control.Distributed.Process.Internal.Primitives
4747 , handleMessage_
4848 , handleMessageIf_
4949 , forward
50+ , uforward
5051 , delegate
5152 , relay
5253 , proxy
@@ -473,6 +474,26 @@ forward msg them = do
473474 liftIO $ traceEvent (localEventBus node)
474475 (MxSent them us msg)
475476
477+-- | Forward a raw 'Message' to the given 'ProcessId'.
478+--
479+-- Unlike 'forward', this function is insensitive to 'reconnect'. It will
480+-- try to send the message regardless of the history of connection failures
481+-- between the nodes.
482+uforward :: Message -> ProcessId -> Process ()
483+uforward msg them = do
484+ proc <- ask
485+ let node = processNode proc
486+ us = processId proc
487+ nid = localNodeId node
488+ destNode = (processNodeId them) in do
489+ case destNode == nid of
490+ True -> sendCtrlMsg Nothing (LocalSend them msg)
491+ False -> sendCtrlMsg (Just destNode) $ UnreliableSend (processLocalId them)
492+ msg
493+ -- We do not fire the trace event until after the sending is complete;
494+ -- In the remote case, 'sendCtrlMsg' can block in the networking stack.
495+ liftIO $ traceEvent (localEventBus node)
496+ (MxSent them us msg)
476497
477498-- | Wrap a 'Serializable' value in a 'Message'. Note that 'Message's are
478499-- 'Serializable' - like the datum they contain - but also note, deserialising