From f669ed747e7c4eb37c4a6821e0eaaadefbab9d3b Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Thu, 16 Jan 2020 00:09:23 -0500 Subject: Debug print on key mismatch in cookie. --- dht/HandshakeCache.hs | 4 +++- dht/src/Data/Tox/DHT/Multi.hs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dht/HandshakeCache.hs b/dht/HandshakeCache.hs index 00836fc8..6cb9c18f 100644 --- a/dht/HandshakeCache.hs +++ b/dht/HandshakeCache.hs @@ -61,7 +61,9 @@ getSentHandshake hscache me their_addr (Cookie n24 (Identity cd)) ecookie = do Nothing -> do let them = longTermKey cd case Multi.nodeInfo (key2id $ dhtKey cd) their_addr of - Left _ -> return $ return Nothing -- Non-internet address. + Left e -> return $ do + dput XNetCrypto $ "getSentHandshake: " ++ show e + return Nothing -- Non-internet address. Right their_node -> do (s,hs) <- cacheHandshakeSTM hscache me them their_node ecookie now return $ do diff --git a/dht/src/Data/Tox/DHT/Multi.hs b/dht/src/Data/Tox/DHT/Multi.hs index acd645a3..d31ae4b8 100644 --- a/dht/src/Data/Tox/DHT/Multi.hs +++ b/dht/src/Data/Tox/DHT/Multi.hs @@ -122,7 +122,7 @@ nodeInfo :: NodeId -> DSum S Identity -> Either String (DSum T Identity) nodeInfo nid (SessionUDP :=> Identity saddr) = fmap (UDP ==>) $ UDP.nodeInfo nid saddr nodeInfo nid (SessionTCP :=> Identity taddr@(ViaRelay _ nid2 _)) = if nid2 == nid then Right $ TCP ==> taddr - else Left $ "Cached dht-key doesn't match." + else Left $ "Cached dht-key("++show nid2++") doesn't match "++show nid nodeId :: DSum T Identity -> NodeId nodeId (UDP :=> Identity ni ) = UDP.nodeId ni -- cgit v1.2.3