summaryrefslogtreecommitdiff
path: root/examples/testTox.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-06-26 17:29:30 -0400
committerjoe <joe@jerkface.net>2018-06-26 17:29:30 -0400
commit2b2627f11e4f7544d86c78a474872f02665ef109 (patch)
treebc516de9e87e81d86827cb616c14ae63897b2500 /examples/testTox.hs
parent7123e72a7256a146d2d756394eab863c5d536fc9 (diff)
Thread report in test program.
Diffstat (limited to 'examples/testTox.hs')
-rw-r--r--examples/testTox.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/testTox.hs b/examples/testTox.hs
index 45bc661e..53ed25dc 100644
--- a/examples/testTox.hs
+++ b/examples/testTox.hs
@@ -1,4 +1,5 @@
1{-# LANGUAGE NamedFieldPuns #-} 1{-# LANGUAGE NamedFieldPuns #-}
2import Control.Concurrent (threadDelay)
2import Control.Concurrent.STM.TChan 3import Control.Concurrent.STM.TChan
3import Control.Concurrent.STM.TMChan 4import Control.Concurrent.STM.TMChan
4import Control.Concurrent.STM.TVar 5import Control.Concurrent.STM.TVar
@@ -6,6 +7,8 @@ import Control.Concurrent.Supply
6import Control.Monad.STM 7import Control.Monad.STM
7import Crypto.Tox 8import Crypto.Tox
8import qualified Data.IntMap.Strict as IntMap 9import qualified Data.IntMap.Strict as IntMap
10import DebugUtil
11import DPut
9import Network.QueryResponse 12import Network.QueryResponse
10import Network.Socket 13import Network.Socket
11import Network.Tox 14import Network.Tox
@@ -14,7 +17,6 @@ import qualified Network.Tox.Crypto.Handlers as CH
14import Network.Tox.Crypto.Transport 17import Network.Tox.Crypto.Transport
15import Network.Tox.DHT.Handlers as DHT 18import Network.Tox.DHT.Handlers as DHT
16import Network.Tox.Onion.Transport (UDPTransport) 19import Network.Tox.Onion.Transport (UDPTransport)
17import DPut
18 20
19 21
20makeToxNode :: UDPTransport -> Maybe SecretKey -> IO (Tox extra) 22makeToxNode :: UDPTransport -> Maybe SecretKey -> IO (Tox extra)
@@ -71,10 +73,15 @@ main = do
71 (a_quit,_,_) <- forkTox a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf False 73 (a_quit,_,_) <- forkTox a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf False
72 (b_quit,_,_) <- forkTox b_OM7znaPMYkTbm'9GcZJAdnDATXmZxZ9fnaSTP3qNCZk False 74 (b_quit,_,_) <- forkTox b_OM7znaPMYkTbm'9GcZJAdnDATXmZxZ9fnaSTP3qNCZk False
73 75
76 threadReport False >>= putStrLn
74 77
75 DHT.ping (toxDHT a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf) b 78 DHT.ping (toxDHT a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf) b
76 79
77 putStrLn "Type Enter to quit..." 80 putStrLn "Type Enter to quit..."
78 getLine 81 getLine
79 82
80 return () 83 a_quit
84 b_quit
85
86 threadDelay 500000
87 threadReport False >>= putStrLn