summaryrefslogtreecommitdiff
path: root/dht/examples/testTox.hs
diff options
context:
space:
mode:
Diffstat (limited to 'dht/examples/testTox.hs')
-rw-r--r--dht/examples/testTox.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/dht/examples/testTox.hs b/dht/examples/testTox.hs
index 6db977be..36162163 100644
--- a/dht/examples/testTox.hs
+++ b/dht/examples/testTox.hs
@@ -13,8 +13,11 @@ import Control.Concurrent.STM.TVar
13import Control.Monad 13import Control.Monad
14import Control.Monad.STM 14import Control.Monad.STM
15import Crypto.Tox 15import Crypto.Tox
16import Data.Dependent.Sum
16import qualified Data.IntMap.Strict as IntMap 17import qualified Data.IntMap.Strict as IntMap
17import Data.Function 18import Data.Function
19import Data.Tox.Msg
20import qualified Data.Tox.DHT.Multi as Multi
18import DebugUtil 21import DebugUtil
19import DPut 22import DPut
20import DebugTag 23import DebugTag
@@ -34,8 +37,6 @@ import qualified Data.HashMap.Strict as HashMap
34import qualified Data.Map.Strict as Map 37import qualified Data.Map.Strict as Map
35import Data.Time.Clock.POSIX 38import Data.Time.Clock.POSIX
36import System.Exit 39import System.Exit
37import Data.Dependent.Sum
38import Data.Tox.Msg
39 40
40makeToxNode :: UDPTransport -> Maybe SecretKey 41makeToxNode :: UDPTransport -> Maybe SecretKey
41 -> ( ContactInfo extra -> SockAddr -> Session -> IO () ) 42 -> ( ContactInfo extra -> SockAddr -> Session -> IO () )
@@ -74,11 +75,11 @@ sessionChan remotes tchan acnt saddr s = do
74 75
75netCrypto :: Tox extra -> SecretKey -> NodeInfo -> PublicKey -> IO () 76netCrypto :: Tox extra -> SecretKey -> NodeInfo -> PublicKey -> IO ()
76netCrypto tox me ni them = do 77netCrypto tox me ni them = do
77 mcookie <- cookieRequest (toxCryptoKeys tox) (toxDHT tox) (toPublic me) ni 78 mcookie <- cookieRequest (toxCryptoKeys tox) (toxDHT tox) (toPublic me) (Multi.UDP ==> ni)
78 case mcookie of 79 case mcookie of
79 Just cookie -> do 80 Just cookie -> do
80 hs <- cacheHandshake (toxHandshakeCache tox) me them ni cookie 81 hs <- cacheHandshake (toxHandshakeCache tox) me them (Multi.UDP ==> ni) cookie
81 sendMessage (toxHandshakes tox) (nodeAddr ni) hs 82 sendMessage (toxHandshakes tox) (Multi.SessionUDP ==> nodeAddr ni) hs
82 Nothing -> do 83 Nothing -> do
83 dput XUnused "Timeout requesting cookie." 84 dput XUnused "Timeout requesting cookie."
84 85
@@ -145,7 +146,7 @@ main = do
145 } 146 }
146 ) 147 )
147 148
148 DHT.ping (toxDHT a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf) b 149 DHT.pingUDP (toxDHT a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf) b
149 150
150 -- sendMessage (toxHandshakes a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf) (nodeAddr b) hs 151 -- sendMessage (toxHandshakes a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf) (nodeAddr b) hs
151 152