summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-06-01 22:34:47 -0400
committerjoe <joe@jerkface.net>2018-06-01 22:34:47 -0400
commit8749f7cd8a0811d3a5730a74221d069d20354946 (patch)
tree34544507b48774e656ec1ee2aa77e36b9699ae84 /src/Network
parent11dae7ee45996dd76dff47e20dd51d7da49f0a43 (diff)
tox: Enable nodes with same ip but different id to go into routing table.
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/Tox/DHT/Handlers.hs8
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
351updateRouting :: Client -> Routing -> OnionRouter -> NodeInfo -> Message -> IO () 351updateRouting :: Client -> Routing -> OnionRouter -> NodeInfo -> Message -> IO ()
352updateRouting client routing orouter naddr msg 352updateRouting 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
360updateTable :: Client -> NodeInfo -> OnionRouter -> TriadCommittee NodeId SockAddr -> BucketRefresher NodeId NodeInfo -> IO () 361updateTable :: Client -> NodeInfo -> OnionRouter -> TriadCommittee NodeId SockAddr -> BucketRefresher NodeId NodeInfo -> IO ()
361updateTable client naddr orouter committee refresher = do 362updateTable 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