summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2020-01-16 00:09:23 -0500
committerJoe Crayne <joe@jerkface.net>2020-01-16 00:15:27 -0500
commitf669ed747e7c4eb37c4a6821e0eaaadefbab9d3b (patch)
tree73df3e4b94daaabe3cab36dc61863d37ae2487c6
parent2a35ec75c6aaddf617d3617fc3527e2e54d5cab7 (diff)
Debug print on key mismatch in cookie.
-rw-r--r--dht/HandshakeCache.hs4
-rw-r--r--dht/src/Data/Tox/DHT/Multi.hs2
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
61 Nothing -> do 61 Nothing -> do
62 let them = longTermKey cd 62 let them = longTermKey cd
63 case Multi.nodeInfo (key2id $ dhtKey cd) their_addr of 63 case Multi.nodeInfo (key2id $ dhtKey cd) their_addr of
64 Left _ -> return $ return Nothing -- Non-internet address. 64 Left e -> return $ do
65 dput XNetCrypto $ "getSentHandshake: " ++ show e
66 return Nothing -- Non-internet address.
65 Right their_node -> do 67 Right their_node -> do
66 (s,hs) <- cacheHandshakeSTM hscache me them their_node ecookie now 68 (s,hs) <- cacheHandshakeSTM hscache me them their_node ecookie now
67 return $ do 69 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)
122nodeInfo nid (SessionUDP :=> Identity saddr) = fmap (UDP ==>) $ UDP.nodeInfo nid saddr 122nodeInfo nid (SessionUDP :=> Identity saddr) = fmap (UDP ==>) $ UDP.nodeInfo nid saddr
123nodeInfo nid (SessionTCP :=> Identity taddr@(ViaRelay _ nid2 _)) = 123nodeInfo nid (SessionTCP :=> Identity taddr@(ViaRelay _ nid2 _)) =
124 if nid2 == nid then Right $ TCP ==> taddr 124 if nid2 == nid then Right $ TCP ==> taddr
125 else Left $ "Cached dht-key doesn't match." 125 else Left $ "Cached dht-key("++show nid2++") doesn't match "++show nid
126 126
127nodeId :: DSum T Identity -> NodeId 127nodeId :: DSum T Identity -> NodeId
128nodeId (UDP :=> Identity ni ) = UDP.nodeId ni 128nodeId (UDP :=> Identity ni ) = UDP.nodeId ni