@@ -369,15 +369,42 @@ testTimeout0 transport = do
369369
370370 takeMVar clientDone
371371
372+-- | Test typed channels
373+testTypedChannels :: NT.Transport -> IO ()
374+testTypedChannels transport = do
375+ serverChannel <- newEmptyMVar :: IO (MVar (SendPort (SendPort Bool, Int)))
376+ clientDone <- newEmptyMVar
377+
378+ forkIO $ do
379+ localNode <- newLocalNode transport initRemoteTable
380+ forkProcess localNode $ do
381+ (serverSendPort, rport) <- newChan
382+ liftIO $ putMVar serverChannel serverSendPort
383+ (clientSendPort, i) <- receiveChan rport
384+ sendChan clientSendPort (even i)
385+ return ()
386+
387+ forkIO $ do
388+ localNode <- newLocalNode transport initRemoteTable
389+ serverSendPort <- readMVar serverChannel
390+ runProcess localNode $ do
391+ (clientSendPort, rport) <- newChan
392+ sendChan serverSendPort (clientSendPort, 5)
393+ False <- receiveChan rport
394+ liftIO $ putMVar clientDone ()
395+
396+ takeMVar clientDone
397+
372398main :: IO ()
373399main = do
374400 Right transport <- createTransport "127.0.0.1" "8080" defaultTCPParameters
375401 runTests
376− [ ("Ping", testPing transport)
377− , ("Math", testMath transport)
378− , ("Timeout", testTimeout transport)
379− , ("Timeout0", testTimeout0 transport)
402+ [ ("Ping", testPing transport)
403+ , ("Math", testMath transport)
404+ , ("Timeout", testTimeout transport)
405+ , ("Timeout0", testTimeout0 transport)
380406 , ("SendToTerminated", testSendToTerminated transport)
407+ , ("TypedChannnels", testTypedChannels transport)
381408 -- The "missing" combinations in the list below don't make much sense, as
382409 -- we cannot guarantee that the monitor reply or link exception will not
383410 -- happen before the unmonitor or unlink