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.hs20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/Network/Tox.hs b/src/Network/Tox.hs
index c0e1dee0..93e3c663 100644
--- a/src/Network/Tox.hs
+++ b/src/Network/Tox.hs
@@ -86,16 +86,17 @@ import Network.BitTorrent.DHT.Token as Token
86import GHC.TypeLits 86import GHC.TypeLits
87 87
88import Crypto.Tox 88import Crypto.Tox
89import Network.Tox.Transport 89import Data.Word64Map (fitsInInt)
90import Network.Tox.Crypto.Transport (NetCrypto)
91import qualified Network.Tox.DHT.Handlers as DHT
92import qualified Network.Tox.DHT.Transport as DHT
90import Network.Tox.NodeId 93import Network.Tox.NodeId
91import qualified Network.Tox.DHT.Transport as DHT 94import qualified Network.Tox.Onion.Handlers as Onion
92import qualified Network.Tox.DHT.Handlers as DHT
93import qualified Network.Tox.Onion.Transport as Onion 95import qualified Network.Tox.Onion.Transport as Onion
94import qualified Network.Tox.Onion.Handlers as Onion 96import Network.Tox.Transport
95import Network.Tox.Crypto.Transport (NetCrypto)
96import Text.XXD
97import OnionRouter 97import OnionRouter
98import Data.Word64Map (fitsInInt) 98import Roster
99import Text.XXD
99 100
100newCrypto :: IO TransportCrypto 101newCrypto :: IO TransportCrypto
101newCrypto = do 102newCrypto = do
@@ -215,6 +216,7 @@ data Tox = Tox
215 , toxTokens :: TVar SessionTokens 216 , toxTokens :: TVar SessionTokens
216 , toxAnnouncedKeys :: TVar Onion.AnnouncedKeys 217 , toxAnnouncedKeys :: TVar Onion.AnnouncedKeys
217 , toxOnionRoutes :: OnionRouter 218 , toxOnionRoutes :: OnionRouter
219 , toxRoster :: Roster
218 } 220 }
219 221
220getContactInfo :: Tox -> IO DHT.DHTPublicKey 222getContactInfo :: Tox -> IO DHT.DHTPublicKey
@@ -298,16 +300,18 @@ newTox keydb addr = do
298 (hookQueries orouter DHT.transactionKey) 300 (hookQueries orouter DHT.transactionKey)
299 (const id) 301 (const id)
300 302
303 roster <- newRoster
301 return Tox 304 return Tox
302 { toxDHT = dhtclient 305 { toxDHT = dhtclient
303 , toxOnion = onionclient 306 , toxOnion = onionclient
304 , toxToRoute = dtacrypt 307 , toxToRoute = onInbound (updateRoster roster) dtacrypt
305 , toxCrypto = cryptonet 308 , toxCrypto = cryptonet
306 , toxCryptoKeys = crypto 309 , toxCryptoKeys = crypto
307 , toxRouting = routing 310 , toxRouting = routing
308 , toxTokens = toks 311 , toxTokens = toks
309 , toxAnnouncedKeys = keydb 312 , toxAnnouncedKeys = keydb
310 , toxOnionRoutes = orouter 313 , toxOnionRoutes = orouter
314 , toxRoster = roster
311 } 315 }
312 316
313onionTimeout :: Tox -> DHT.TransactionId -> Onion.OnionDestination RouteId -> STM (Onion.OnionDestination RouteId, Int) 317onionTimeout :: Tox -> DHT.TransactionId -> Onion.OnionDestination RouteId -> STM (Onion.OnionDestination RouteId, Int)