summaryrefslogtreecommitdiff
path: root/src/Network/Tox/DHT/Handlers.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/Tox/DHT/Handlers.hs')
-rw-r--r--src/Network/Tox/DHT/Handlers.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Network/Tox/DHT/Handlers.hs b/src/Network/Tox/DHT/Handlers.hs
index 43169fa0..58a29c3e 100644
--- a/src/Network/Tox/DHT/Handlers.hs
+++ b/src/Network/Tox/DHT/Handlers.hs
@@ -404,9 +404,9 @@ unwrapNodes (SendNodes ns) = (ns,ns,Just ())
404 404
405getNodes :: Client -> TVar (HashMap NodeId [NodeInfoCallback]) -> NodeId -> NodeInfo -> IO (Maybe ([NodeInfo],[NodeInfo],Maybe ())) 405getNodes :: Client -> TVar (HashMap NodeId [NodeInfoCallback]) -> NodeId -> NodeInfo -> IO (Maybe ([NodeInfo],[NodeInfo],Maybe ()))
406getNodes client cbvar nid addr = do 406getNodes client cbvar nid addr = do
407 -- hPutStrLn stderr $ show addr ++ " <-- getnodes " ++ show nid 407 -- dput XMisc $ show addr ++ " <-- getnodes " ++ show nid
408 reply <- QR.sendQuery client (serializer GetNodesType DHTGetNodes unsendNodes) (GetNodes nid) addr 408 reply <- QR.sendQuery client (serializer GetNodesType DHTGetNodes unsendNodes) (GetNodes nid) addr
409 -- hPutStrLn stderr $ show addr ++ " -sendnodes-> " ++ show reply 409 -- dput XMisc $ show addr ++ " -sendnodes-> " ++ show reply
410 forM_ (join reply) $ \(SendNodes ns) -> 410 forM_ (join reply) $ \(SendNodes ns) ->
411 forM_ ns $ \n -> do 411 forM_ ns $ \n -> do
412 now <- getPOSIXTime 412 now <- getPOSIXTime
@@ -430,13 +430,13 @@ updateRouting client routing orouter naddr msg
430 case prefer4or6 naddr Nothing of 430 case prefer4or6 naddr Nothing of
431 Want_IP4 -> updateTable client naddr orouter (committee4 routing) (refresher4 routing) 431 Want_IP4 -> updateTable client naddr orouter (committee4 routing) (refresher4 routing)
432 Want_IP6 -> updateTable client naddr orouter (committee6 routing) (refresher6 routing) 432 Want_IP6 -> updateTable client naddr orouter (committee6 routing) (refresher6 routing)
433 Want_Both -> do hPutStrLn stderr "BUG:unreachable" 433 Want_Both -> do dput XMisc "BUG:unreachable"
434 error $ "BUG:unreachable at " ++ __FILE__ ++ ":" ++ show __LINE__ 434 error $ "BUG:unreachable at " ++ __FILE__ ++ ":" ++ show __LINE__
435 435
436updateTable :: Client -> NodeInfo -> OnionRouter -> TriadCommittee NodeId SockAddr -> BucketRefresher NodeId NodeInfo -> IO () 436updateTable :: Client -> NodeInfo -> OnionRouter -> TriadCommittee NodeId SockAddr -> BucketRefresher NodeId NodeInfo -> IO ()
437updateTable client naddr orouter committee refresher = do 437updateTable client naddr orouter committee refresher = do
438 self <- atomically $ R.thisNode <$> readTVar (refreshBuckets refresher) 438 self <- atomically $ R.thisNode <$> readTVar (refreshBuckets refresher)
439 -- hPutStrLn stderr $ "(tox)updateRouting: " ++ show (nodeIP self, nodeIP naddr) 439 -- dput XMisc $ "(tox)updateRouting: " ++ show (nodeIP self, nodeIP naddr)
440 when (self /= naddr) $ do 440 when (self /= naddr) $ do
441 -- TODO: IP address vote? 441 -- TODO: IP address vote?
442 insertNode (toxKademlia client committee orouter refresher) naddr 442 insertNode (toxKademlia client committee orouter refresher) naddr
@@ -455,7 +455,7 @@ toxKademlia client committee orouter refresher
455 return $ do 455 return $ do
456 io1 >> io2 456 io1 >> io2
457 {- 457 {-
458 hPutStrLn stderr $ unwords 458 dput XMisc $ unwords
459 [ show (transitionedTo tr) 459 [ show (transitionedTo tr)
460 , show (transitioningNode tr) 460 , show (transitioningNode tr)
461 ] 461 ]
@@ -467,7 +467,7 @@ transitionCommittee :: TriadCommittee NodeId SockAddr -> RoutingTransition NodeI
467transitionCommittee committee (RoutingTransition ni Stranger) = do 467transitionCommittee committee (RoutingTransition ni Stranger) = do
468 delVote committee (nodeId ni) 468 delVote committee (nodeId ni)
469 return $ do 469 return $ do
470 -- hPutStrLn stderr $ "delVote "++show (nodeId ni) 470 -- dput XMisc $ "delVote "++show (nodeId ni)
471 return () 471 return ()
472transitionCommittee committee _ = return $ return () 472transitionCommittee committee _ = return $ return ()
473 473
@@ -500,7 +500,7 @@ isDHTRequest _ _ = Left "Bad dht relay request"
500 500
501dhtRequestH :: NodeInfo -> DHTRequest -> IO () 501dhtRequestH :: NodeInfo -> DHTRequest -> IO ()
502dhtRequestH ni req = do 502dhtRequestH ni req = do
503 hPutStrLn stderr $ "Unhandled DHT Request: " ++ show req 503 dput XMisc $ "Unhandled DHT Request: " ++ show req
504 504
505handlers :: TransportCrypto -> Routing -> PacketKind -> Maybe Handler 505handlers :: TransportCrypto -> Routing -> PacketKind -> Maybe Handler
506handlers _ routing PingType = Just $ MethodHandler (isPing snd) mkPong $ pingH 506handlers _ routing PingType = Just $ MethodHandler (isPing snd) mkPong $ pingH