diff options
Diffstat (limited to 'src/Network')
-rw-r--r-- | src/Network/Tox/DHT/Handlers.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Network/Tox/DHT/Handlers.hs b/src/Network/Tox/DHT/Handlers.hs index 08801cc7..af6eda8c 100644 --- a/src/Network/Tox/DHT/Handlers.hs +++ b/src/Network/Tox/DHT/Handlers.hs | |||
@@ -350,17 +350,19 @@ getNodes client nid addr = do | |||
350 | 350 | ||
351 | updateRouting :: Client -> Routing -> OnionRouter -> NodeInfo -> Message -> IO () | 351 | updateRouting :: Client -> Routing -> OnionRouter -> NodeInfo -> Message -> IO () |
352 | updateRouting client routing orouter naddr msg | 352 | updateRouting client routing orouter naddr msg |
353 | | PacketKind 0x21 <- msgType msg = return () -- ignore lan discovery | 353 | | PacketKind 0x21 <- msgType msg = hPutStrLn stderr "(tox)updateRouting: ignoring lan discovery" -- ignore lan discovery |
354 | | otherwise = do | 354 | | otherwise = do |
355 | case prefer4or6 naddr Nothing of | 355 | case prefer4or6 naddr Nothing of |
356 | Want_IP4 -> updateTable client naddr orouter (committee4 routing) (refresher4 routing) | 356 | Want_IP4 -> updateTable client naddr orouter (committee4 routing) (refresher4 routing) |
357 | Want_IP6 -> updateTable client naddr orouter (committee6 routing) (refresher4 routing) | 357 | Want_IP6 -> updateTable client naddr orouter (committee6 routing) (refresher4 routing) |
358 | Want_Both -> error $ "BUG:unreachable at " ++ __FILE__ ++ ":" ++ show __LINE__ | 358 | Want_Both -> do hPutStrLn stderr "BUG:unreachable" |
359 | error $ "BUG:unreachable at " ++ __FILE__ ++ ":" ++ show __LINE__ | ||
359 | 360 | ||
360 | updateTable :: Client -> NodeInfo -> OnionRouter -> TriadCommittee NodeId SockAddr -> BucketRefresher NodeId NodeInfo -> IO () | 361 | updateTable :: Client -> NodeInfo -> OnionRouter -> TriadCommittee NodeId SockAddr -> BucketRefresher NodeId NodeInfo -> IO () |
361 | updateTable client naddr orouter committee refresher = do | 362 | updateTable client naddr orouter committee refresher = do |
362 | self <- atomically $ R.thisNode <$> readTVar (refreshBuckets refresher) | 363 | self <- atomically $ R.thisNode <$> readTVar (refreshBuckets refresher) |
363 | when (nodeIP self /= nodeIP naddr) $ do | 364 | -- hPutStrLn stderr $ "(tox)updateRouting: " ++ show (nodeIP self, nodeIP naddr) |
365 | when (self /= naddr) $ do | ||
364 | -- TODO: IP address vote? | 366 | -- TODO: IP address vote? |
365 | insertNode (toxKademlia client committee orouter refresher) naddr | 367 | insertNode (toxKademlia client committee orouter refresher) naddr |
366 | 368 | ||