git.iko.soy/distributed-process
on master help sign in
Merge pull request #195 from haskell-distributed/strict-sendCtrlMsg
a35cc21Mathieu Boespflug
src/Control/Distributed/Process/Internal/Messaging.hs+6−2
@@ -177,7 +177,11 @@ _ `impliesDeathOf` _ =
177 False
177 False
178
178
179
179
180−-- Send a control message
180+-- Send a control message. Evaluates the message to HNF before sending it.
181+--
182+-- The message shouldn't produce more errors when further evaluated. If
183+-- evaluation threw errors the node controller or the receiver would crash when
184+-- inspecting it.
181sendCtrlMsg :: Maybe NodeId -- ^ Nothing for the local node
185sendCtrlMsg :: Maybe NodeId -- ^ Nothing for the local node
182 -> ProcessSignal -- ^ Message to send
186 -> ProcessSignal -- ^ Message to send
183 -> Process ()
187 -> Process ()
@@ -188,7 +192,7 @@ sendCtrlMsg mNid signal = do
188 }
192 }
189 case mNid of
193 case mNid of
190 Nothing -> do
194 Nothing -> do
191− liftIO $ writeChan (localCtrlChan (processNode proc)) msg
195+ liftIO $ writeChan (localCtrlChan (processNode proc)) $! msg
192 Just nid ->
196 Just nid ->
193 liftIO $ sendBinary (processNode proc)
197 liftIO $ sendBinary (processNode proc)
194 (ProcessIdentifier (processId proc))
198 (ProcessIdentifier (processId proc))