From 8749f7cd8a0811d3a5730a74221d069d20354946 Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 1 Jun 2018 22:34:47 -0400 Subject: tox: Enable nodes with same ip but different id to go into routing table. --- src/Network/Tox/DHT/Handlers.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/Network') 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 updateRouting :: Client -> Routing -> OnionRouter -> NodeInfo -> Message -> IO () updateRouting client routing orouter naddr msg - | PacketKind 0x21 <- msgType msg = return () -- ignore lan discovery + | PacketKind 0x21 <- msgType msg = hPutStrLn stderr "(tox)updateRouting: ignoring lan discovery" -- ignore lan discovery | otherwise = do case prefer4or6 naddr Nothing of Want_IP4 -> updateTable client naddr orouter (committee4 routing) (refresher4 routing) Want_IP6 -> updateTable client naddr orouter (committee6 routing) (refresher4 routing) - Want_Both -> error $ "BUG:unreachable at " ++ __FILE__ ++ ":" ++ show __LINE__ + Want_Both -> do hPutStrLn stderr "BUG:unreachable" + error $ "BUG:unreachable at " ++ __FILE__ ++ ":" ++ show __LINE__ updateTable :: Client -> NodeInfo -> OnionRouter -> TriadCommittee NodeId SockAddr -> BucketRefresher NodeId NodeInfo -> IO () updateTable client naddr orouter committee refresher = do self <- atomically $ R.thisNode <$> readTVar (refreshBuckets refresher) - when (nodeIP self /= nodeIP naddr) $ do + -- hPutStrLn stderr $ "(tox)updateRouting: " ++ show (nodeIP self, nodeIP naddr) + when (self /= naddr) $ do -- TODO: IP address vote? insertNode (toxKademlia client committee orouter refresher) naddr -- cgit v1.2.3