summaryrefslogtreecommitdiff
path: root/src/Network/Tox.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/Tox.hs')
-rw-r--r--src/Network/Tox.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Network/Tox.hs b/src/Network/Tox.hs
index 51ee0a4d..56c4b8e6 100644
--- a/src/Network/Tox.hs
+++ b/src/Network/Tox.hs
@@ -85,7 +85,7 @@ import Control.TriadCommittee
85import Network.BitTorrent.DHT.Token as Token 85import Network.BitTorrent.DHT.Token as Token
86import GHC.TypeLits 86import GHC.TypeLits
87 87
88import Crypto.Tox hiding (Assym) 88import Crypto.Tox
89import Network.Tox.Transport 89import Network.Tox.Transport
90import Network.Tox.NodeId 90import Network.Tox.NodeId
91import qualified Network.Tox.DHT.Transport as DHT 91import qualified Network.Tox.DHT.Transport as DHT
@@ -202,6 +202,7 @@ newClient drg net classify selfAddr handlers modifytbl modifynet = do
202data Tox = Tox 202data Tox = Tox
203 { toxDHT :: DHT.Client 203 { toxDHT :: DHT.Client
204 , toxOnion :: Onion.Client RouteId 204 , toxOnion :: Onion.Client RouteId
205 , toxToRoute :: Transport String Onion.Rendezvous (Assym (Encrypted Onion.DataToRoute))
205 , toxCrypto :: Transport String SockAddr NetCrypto 206 , toxCrypto :: Transport String SockAddr NetCrypto
206 , toxRouting :: DHT.Routing 207 , toxRouting :: DHT.Routing
207 , toxTokens :: TVar SessionTokens 208 , toxTokens :: TVar SessionTokens
@@ -249,7 +250,7 @@ newTox keydb addr = do
249 250
250 routing <- DHT.newRouting addr crypto updateIP updateIP 251 routing <- DHT.newRouting addr crypto updateIP updateIP
251 orouter <- newOnionRouter 252 orouter <- newOnionRouter
252 (dhtcrypt,onioncrypt,cryptonet) <- toxTransport crypto orouter lookupClose udp 253 (dhtcrypt,onioncrypt,dtacrypt,cryptonet) <- toxTransport crypto orouter lookupClose udp
253 let dhtnet0 = layerTransport (DHT.decrypt crypto) (DHT.encrypt crypto) dhtcrypt 254 let dhtnet0 = layerTransport (DHT.decrypt crypto) (DHT.encrypt crypto) dhtcrypt
254 dhtclient <- newClient drg dhtnet0 DHT.classify (myAddr routing) (DHT.handlers routing) id 255 dhtclient <- newClient drg dhtnet0 DHT.classify (myAddr routing) (DHT.handlers routing) id
255 $ \client net -> onInbound (DHT.updateRouting client routing orouter) net 256 $ \client net -> onInbound (DHT.updateRouting client routing orouter) net
@@ -270,6 +271,7 @@ newTox keydb addr = do
270 return Tox 271 return Tox
271 { toxDHT = dhtclient 272 { toxDHT = dhtclient
272 , toxOnion = onionclient 273 , toxOnion = onionclient
274 , toxToRoute = dtacrypt
273 , toxCrypto = cryptonet 275 , toxCrypto = cryptonet
274 , toxRouting = routing 276 , toxRouting = routing
275 , toxTokens = toks 277 , toxTokens = toks
@@ -283,6 +285,7 @@ onionTimeout Tox { toxOnionRoutes = or } (DHT.TransactionId n8 _) od = lookupTim
283forkTox :: Tox -> IO (IO ()) 285forkTox :: Tox -> IO (IO ())
284forkTox tox = do 286forkTox tox = do
285 _ <- forkListener "toxCrypto" (toxCrypto tox) 287 _ <- forkListener "toxCrypto" (toxCrypto tox)
288 _ <- forkListener "toxToRoute" (toxToRoute tox)
286 _ <- forkListener "toxOnion" (clientNet $ toxOnion tox) 289 _ <- forkListener "toxOnion" (clientNet $ toxOnion tox)
287 forkListener "toxDHT" (clientNet $ toxDHT tox) 290 forkListener "toxDHT" (clientNet $ toxDHT tox)
288 291