diff options
-rw-r--r-- | src/Network/Tox/DHT/Handlers.hs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Network/Tox/DHT/Handlers.hs b/src/Network/Tox/DHT/Handlers.hs index 09d6f66b..b1db9044 100644 --- a/src/Network/Tox/DHT/Handlers.hs +++ b/src/Network/Tox/DHT/Handlers.hs | |||
@@ -273,7 +273,6 @@ createCookie crypto ni remoteUserKey = do | |||
273 | , dhtKey = id2key $ nodeId ni -- transportPublic crypto | 273 | , dhtKey = id2key $ nodeId ni -- transportPublic crypto |
274 | } | 274 | } |
275 | edta = encryptSymmetric sym n24 dta | 275 | edta = encryptSymmetric sym n24 dta |
276 | dput XNetCrypto $ "Created cookie with n24 = 0x" ++ show n24 ++ "\n sym=" ++ show sym | ||
277 | return $ Cookie n24 edta | 276 | return $ Cookie n24 edta |
278 | 277 | ||
279 | createCookieSTM :: POSIXTime -> TransportCrypto -> NodeInfo -> PublicKey -> STM (Cookie Encrypted) | 278 | createCookieSTM :: POSIXTime -> TransportCrypto -> NodeInfo -> PublicKey -> STM (Cookie Encrypted) |
@@ -290,20 +289,20 @@ createCookieSTM now crypto ni remoteUserKey = do | |||
290 | , dhtKey = id2key $ nodeId ni -- transportPublic crypto | 289 | , dhtKey = id2key $ nodeId ni -- transportPublic crypto |
291 | } | 290 | } |
292 | edta = encryptSymmetric sym n24 dta | 291 | edta = encryptSymmetric sym n24 dta |
293 | dmsg $ "(createCookieSTM) Created cookie with n24 = 0x" ++ show n24 ++ "\n sym=" ++ show sym | ||
294 | return $ Cookie n24 edta | 292 | return $ Cookie n24 edta |
295 | 293 | ||
296 | cookieRequestH :: TransportCrypto -> NodeInfo -> CookieRequest -> IO (Cookie Encrypted) | 294 | cookieRequestH :: TransportCrypto -> NodeInfo -> CookieRequest -> IO (Cookie Encrypted) |
297 | cookieRequestH crypto ni (CookieRequest remoteUserKey) = do | 295 | cookieRequestH crypto ni (CookieRequest remoteUserKey) = do |
298 | dput XNetCrypto $ unlines | 296 | dput XNetCrypto $ unlines |
299 | [ "CookieRequest! remoteUserKey=" ++ show (key2id remoteUserKey) | 297 | [ show (nodeAddr ni) ++ " --> request cookie: remoteUserKey=" ++ show (key2id remoteUserKey) |
300 | , " sender=" ++ show ni ] | 298 | , show (nodeAddr ni) ++ " --> sender=" ++ show (nodeId ni) ] |
301 | x <- createCookie crypto ni remoteUserKey | 299 | x <- createCookie crypto ni remoteUserKey |
302 | dput XNetCrypto $ "CookieRequest! responding to " ++ show (key2id remoteUserKey) | 300 | dput XNetCrypto $ show (nodeAddr ni) ++ " <-- cookie " ++ show (key2id remoteUserKey) |
303 | return x | 301 | return x |
304 | 302 | ||
305 | lanDiscoveryH :: Client -> NodeInfo -> NodeInfo -> IO (Maybe (Message -> Message)) | 303 | lanDiscoveryH :: Client -> NodeInfo -> NodeInfo -> IO (Maybe (Message -> Message)) |
306 | lanDiscoveryH client _ ni = do | 304 | lanDiscoveryH client _ ni = do |
305 | dput XLan $ show (nodeAddr ni) ++ " --> LanAnnounce " ++ show (nodeId ni) | ||
307 | forkIO $ do | 306 | forkIO $ do |
308 | myThreadId >>= flip labelThread "lan-discover-ping" | 307 | myThreadId >>= flip labelThread "lan-discover-ping" |
309 | ping client ni | 308 | ping client ni |
@@ -417,7 +416,10 @@ getNodes client cbvar nid addr = do | |||
417 | 416 | ||
418 | updateRouting :: Client -> Routing -> OnionRouter -> NodeInfo -> Message -> IO () | 417 | updateRouting :: Client -> Routing -> OnionRouter -> NodeInfo -> Message -> IO () |
419 | updateRouting client routing orouter naddr msg | 418 | updateRouting client routing orouter naddr msg |
420 | | PacketKind 0x21 <- msgType msg = dput XLan "(tox)updateRouting: ignoring lan discovery" -- ignore lan discovery | 419 | | PacketKind 0x21 <- msgType msg = -- dput XLan "(tox)updateRouting: ignoring lan discovery" -- ignore lan discovery |
420 | -- Ignore lan announcements until they reply to our ping. | ||
421 | -- We do this because the lan announce is not authenticated. | ||
422 | return () | ||
421 | | otherwise = do | 423 | | otherwise = do |
422 | now <- getPOSIXTime | 424 | now <- getPOSIXTime |
423 | atomically $ do | 425 | atomically $ do |