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.hs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Network/Tox.hs b/src/Network/Tox.hs
index 6f591917..9f41fbe5 100644
--- a/src/Network/Tox.hs
+++ b/src/Network/Tox.hs
@@ -282,12 +282,18 @@ getOnionAlias crypto dhtself remoteNode = atomically $ do
282 return $ Onion.OnionDestination Onion.SearchingAlias alias Nothing 282 return $ Onion.OnionDestination Onion.SearchingAlias alias Nothing
283 283
284 284
285newTox :: TVar Onion.AnnouncedKeys -> SockAddr -> Maybe NetCryptoSessions -> IO Tox 285newTox :: TVar Onion.AnnouncedKeys -> SockAddr -> Maybe NetCryptoSessions -> Maybe SecretKey -> IO Tox
286newTox keydb addr mbSessionsState = do 286newTox keydb addr mbSessionsState suppliedDHTKey = do
287 udp <- addVerbosity <$> udpTransport addr 287 udp <- addVerbosity <$> udpTransport addr
288 (crypto,sessionsState) <- case mbSessionsState of 288 (crypto,sessionsState) <- case mbSessionsState of
289 Nothing -> do 289 Nothing -> do
290 crypto <- newCrypto 290 crypto0 <- newCrypto
291 let crypto = fromMaybe crypto0 $do
292 k <- suppliedDHTKey
293 return crypto0
294 { transportSecret = k
295 , transportPublic = toPublic k
296 }
291 sessionsState <- newSessionsState crypto defaultUnRecHook defaultCryptoDataHooks 297 sessionsState <- newSessionsState crypto defaultUnRecHook defaultCryptoDataHooks
292 return (crypto,sessionsState) 298 return (crypto,sessionsState)
293 Just s -> return (transportCrypto s, s) 299 Just s -> return (transportCrypto s, s)