diff options
author | joe <joe@jerkface.net> | 2018-05-31 20:23:37 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2018-05-31 20:23:37 -0400 |
commit | eb4593ae974441b8c242849305c749494b041f3c (patch) | |
tree | 3037190f53729ee115b6425a19a359a376429686 /src/Network/Tox.hs | |
parent | 0bdbb7e4d351c66238ef4e39d3a6ef7828c19be1 (diff) |
Update roster and supplied dht-key seperately (in case no dhtkey).
Diffstat (limited to 'src/Network/Tox.hs')
-rw-r--r-- | src/Network/Tox.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Network/Tox.hs b/src/Network/Tox.hs index 3bf7b6f1..018361aa 100644 --- a/src/Network/Tox.hs +++ b/src/Network/Tox.hs | |||
@@ -417,13 +417,15 @@ newTox keydb addr mbSessionsState suppliedDHTKey = do | |||
417 | Just s -> return (transportCrypto s, s) | 417 | Just s -> return (transportCrypto s, s) |
418 | 418 | ||
419 | roster <- newContactInfo | 419 | roster <- newContactInfo |
420 | let crypto = fromMaybe crypto0 $do | 420 | let -- patch in supplied DHT key |
421 | crypto1 = fromMaybe crypto0 $do | ||
421 | k <- suppliedDHTKey | 422 | k <- suppliedDHTKey |
422 | return crypto0 | 423 | return crypto0 |
423 | { transportSecret = k | 424 | { transportSecret = k |
424 | , transportPublic = toPublic k | 425 | , transportPublic = toPublic k |
425 | , userKeys = myKeyPairs roster | ||
426 | } | 426 | } |
427 | -- patch in newly allocated roster state. | ||
428 | crypto = crypto1 { userKeys = myKeyPairs roster } | ||
427 | forM_ suppliedDHTKey $ \k -> do | 429 | forM_ suppliedDHTKey $ \k -> do |
428 | maybe (hPutStrLn stderr "failed to encode suppliedDHTKey") | 430 | maybe (hPutStrLn stderr "failed to encode suppliedDHTKey") |
429 | (C8.hPutStrLn stderr . C8.append "Using suppliedDHTKey: ") | 431 | (C8.hPutStrLn stderr . C8.append "Using suppliedDHTKey: ") |