diff options
Diffstat (limited to 'dht/examples/testTox.hs')
-rw-r--r-- | dht/examples/testTox.hs | 13 |
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 | |||
13 | import Control.Monad | 13 | import Control.Monad |
14 | import Control.Monad.STM | 14 | import Control.Monad.STM |
15 | import Crypto.Tox | 15 | import Crypto.Tox |
16 | import Data.Dependent.Sum | ||
16 | import qualified Data.IntMap.Strict as IntMap | 17 | import qualified Data.IntMap.Strict as IntMap |
17 | import Data.Function | 18 | import Data.Function |
19 | import Data.Tox.Msg | ||
20 | import qualified Data.Tox.DHT.Multi as Multi | ||
18 | import DebugUtil | 21 | import DebugUtil |
19 | import DPut | 22 | import DPut |
20 | import DebugTag | 23 | import DebugTag |
@@ -34,8 +37,6 @@ import qualified Data.HashMap.Strict as HashMap | |||
34 | import qualified Data.Map.Strict as Map | 37 | import qualified Data.Map.Strict as Map |
35 | import Data.Time.Clock.POSIX | 38 | import Data.Time.Clock.POSIX |
36 | import System.Exit | 39 | import System.Exit |
37 | import Data.Dependent.Sum | ||
38 | import Data.Tox.Msg | ||
39 | 40 | ||
40 | makeToxNode :: UDPTransport -> Maybe SecretKey | 41 | makeToxNode :: 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 | ||
75 | netCrypto :: Tox extra -> SecretKey -> NodeInfo -> PublicKey -> IO () | 76 | netCrypto :: Tox extra -> SecretKey -> NodeInfo -> PublicKey -> IO () |
76 | netCrypto tox me ni them = do | 77 | netCrypto 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 | ||