git.iko.soy/distributed-process
on master help sign in
Make 'sendCtrlMsg' strict in the local case.

Now it evaluates the input message to HNF. If left non-strict, the NC would stop when evaluating a message fails or blocks. It is still possible to crash the NC if deeper evaluation of the message produces errors. For this sake we make a precondition of 'sendCtrlMsg' that further evaluation of the message should not produce errors in the local case.

commit925ff92de39de87fa5a291e97e46aa48249fba8a authorFacundo Domínguez <facundo.dominguez@tweag.io> dateThu 11 Jun 2015, 16:12 (11 years ago) parent4e89b9d
1 file changed+6−2
src/Control/Distributed/Process/Internal/Messaging.hs+6−2
src/Control/Distributed/Process/Internal/Messaging.hs+6−2
@@ -177,7 +177,11 @@ _ `impliesDeathOf` _ =
177177 False
178178
179179
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.
181185sendCtrlMsg :: Maybe NodeId -- ^ Nothing for the local node
182186 -> ProcessSignal -- ^ Message to send
183187 -> Process ()
@@ -188,7 +192,7 @@ sendCtrlMsg mNid signal = do
188192 }
189193 case mNid of
190194 Nothing -> do
191− liftIO $ writeChan (localCtrlChan (processNode proc)) msg
195+ liftIO $ writeChan (localCtrlChan (processNode proc)) $! msg
192196 Just nid ->
193197 liftIO $ sendBinary (processNode proc)
194198 (ProcessIdentifier (processId proc))