summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/testTox.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/testTox.hs b/examples/testTox.hs
index a58c1fa0..5314024f 100644
--- a/examples/testTox.hs
+++ b/examples/testTox.hs
@@ -28,6 +28,7 @@ import Network.Tox.Onion.Transport
28import Connection 28import Connection
29import qualified Data.HashMap.Strict as HashMap 29import qualified Data.HashMap.Strict as HashMap
30 ;import Data.HashMap.Strict (HashMap) 30 ;import Data.HashMap.Strict (HashMap)
31import qualified Data.Map.Strict as Map
31import Data.Time.Clock.POSIX 32import Data.Time.Clock.POSIX
32import System.Exit 33import System.Exit
33 34
@@ -125,6 +126,24 @@ main = do
125 tid <- myThreadId 126 tid <- myThreadId
126 labelThread tid "testToxLaunch" 127 labelThread tid "testToxLaunch"
127 void $ netCrypto a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf a_secret b_public 128 void $ netCrypto a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf a_secret b_public
129 dput XUnused "REACHEDREACHEDREACHEDREACHED"
130 dput XUnused "REACHEDREACHEDREACHEDREACHED"
131 dput XUnused "REACHEDREACHEDREACHEDREACHED"
132 threadDelay 1000000
133 -- a says "Howdy"
134 mp_a <- atomically . readTVar $ CH.netCryptoSessionsByKey (toxCryptoSessions a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf)
135 case Map.lookup b_public mp_a of
136 Just [session] -> do
137 dput XUnused "----------------- HOWDY ---------------"
138 CH.sendChatMsg (toxCryptoKeys a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf) session "Howdy"
139 -- b says "Hey you!"
140 mp_b <- atomically . readTVar $ CH.netCryptoSessionsByKey (toxCryptoSessions b_OM7znaPMYkTbm'9GcZJAdnDATXmZxZ9fnaSTP3qNCZk)
141 case Map.lookup a_public mp_b of
142 Just [session] -> do
143 dput XUnused "----------------- HEY YOU ---------------"
144 void $ CH.sendChatMsg (toxCryptoKeys b_OM7znaPMYkTbm'9GcZJAdnDATXmZxZ9fnaSTP3qNCZk) session "Hey you!"
145 Just xs -> dput XUnused "Unexpectedly b has TOO MANY sesions for a"
146 Nothing -> dput XUnused "Unexpectedly b has NO session for a"
128 147
129 putStrLn "Type Enter to quit..." 148 putStrLn "Type Enter to quit..."
130 getLine 149 getLine