diff options
-rw-r--r-- | examples/dhtd.hs | 7 | ||||
-rw-r--r-- | src/Network/Tox.hs | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs index c0330657..f54c5249 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs | |||
@@ -353,6 +353,7 @@ data Session = Session | |||
353 | , dhts :: Map.Map String DHT | 353 | , dhts :: Map.Map String DHT |
354 | , externalAddresses :: IO [SockAddr] | 354 | , externalAddresses :: IO [SockAddr] |
355 | , swarms :: Mainline.SwarmsDatabase | 355 | , swarms :: Mainline.SwarmsDatabase |
356 | , cryptosessions :: Tox.NetCryptoSessions | ||
356 | , toxkeys :: TVar Tox.AnnouncedKeys | 357 | , toxkeys :: TVar Tox.AnnouncedKeys |
357 | , userkeys :: TVar [(SecretKey,PublicKey)] | 358 | , userkeys :: TVar [(SecretKey,PublicKey)] |
358 | , roster :: Roster | 359 | , roster :: Roster |
@@ -947,12 +948,13 @@ main = do | |||
947 | 948 | ||
948 | keysdb <- Tox.newKeysDatabase | 949 | keysdb <- Tox.newKeysDatabase |
949 | 950 | ||
951 | crypto <- Tox.newCrypto | ||
952 | netCryptoSessionsState <- Tox.newSessionsState crypto Tox.defaultUnRecHook Tox.defaultCryptoDataHooks | ||
953 | |||
950 | (mbtox,quitTox,toxdhts,toxips,taddrs) <- case porttox opts of | 954 | (mbtox,quitTox,toxdhts,toxips,taddrs) <- case porttox opts of |
951 | "" -> return (Nothing,return (), Map.empty, return [],[]) | 955 | "" -> return (Nothing,return (), Map.empty, return [],[]) |
952 | toxport -> do | 956 | toxport -> do |
953 | addrTox <- getBindAddress toxport (ip6tox opts) | 957 | addrTox <- getBindAddress toxport (ip6tox opts) |
954 | crypto <- Tox.newCrypto | ||
955 | netCryptoSessionsState <- Tox.newSessionsState crypto Tox.defaultUnRecHook Tox.defaultCryptoDataHooks | ||
956 | tox <- Tox.newTox keysdb addrTox (Just netCryptoSessionsState) | 958 | tox <- Tox.newTox keysdb addrTox (Just netCryptoSessionsState) |
957 | quitTox <- Tox.forkTox tox | 959 | quitTox <- Tox.forkTox tox |
958 | 960 | ||
@@ -1133,6 +1135,7 @@ main = do | |||
1133 | , dhts = dhts -- all DHTs | 1135 | , dhts = dhts -- all DHTs |
1134 | , signalQuit = signalQuit | 1136 | , signalQuit = signalQuit |
1135 | , swarms = swarms | 1137 | , swarms = swarms |
1138 | , cryptosessions = netCryptoSessionsState | ||
1136 | , toxkeys = keysdb | 1139 | , toxkeys = keysdb |
1137 | , userkeys = toxids | 1140 | , userkeys = toxids |
1138 | , roster = rstr | 1141 | , roster = rstr |
diff --git a/src/Network/Tox.hs b/src/Network/Tox.hs index f73de4e9..0400f14a 100644 --- a/src/Network/Tox.hs +++ b/src/Network/Tox.hs | |||
@@ -219,6 +219,7 @@ data Tox = Tox | |||
219 | , toxOnion :: Onion.Client RouteId | 219 | , toxOnion :: Onion.Client RouteId |
220 | , toxToRoute :: Transport String Onion.AnnouncedRendezvous (PublicKey,Onion.OnionData) | 220 | , toxToRoute :: Transport String Onion.AnnouncedRendezvous (PublicKey,Onion.OnionData) |
221 | , toxCrypto :: Transport String SockAddr NetCrypto | 221 | , toxCrypto :: Transport String SockAddr NetCrypto |
222 | , toxCryptoSessions :: NetCryptoSessions | ||
222 | , toxCryptoKeys :: TransportCrypto | 223 | , toxCryptoKeys :: TransportCrypto |
223 | , toxRouting :: DHT.Routing | 224 | , toxRouting :: DHT.Routing |
224 | , toxTokens :: TVar SessionTokens | 225 | , toxTokens :: TVar SessionTokens |
@@ -319,6 +320,7 @@ newTox keydb addr mbSessionsState = do | |||
319 | , toxOnion = onionclient | 320 | , toxOnion = onionclient |
320 | , toxToRoute = onInbound (updateRoster roster) dtacrypt | 321 | , toxToRoute = onInbound (updateRoster roster) dtacrypt |
321 | , toxCrypto = addHandler (hPutStrLn stderr) (cryptoNetHandler sessionsState) cryptonet | 322 | , toxCrypto = addHandler (hPutStrLn stderr) (cryptoNetHandler sessionsState) cryptonet |
323 | , toxCryptoSessions = sessionsState | ||
322 | , toxCryptoKeys = crypto | 324 | , toxCryptoKeys = crypto |
323 | , toxRouting = routing | 325 | , toxRouting = routing |
324 | , toxTokens = toks | 326 | , toxTokens = toks |