diff options
author | Joe Crayne <joe@jerkface.net> | 2020-01-16 00:09:23 -0500 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2020-01-16 00:15:27 -0500 |
commit | f669ed747e7c4eb37c4a6821e0eaaadefbab9d3b (patch) | |
tree | 73df3e4b94daaabe3cab36dc61863d37ae2487c6 | |
parent | 2a35ec75c6aaddf617d3617fc3527e2e54d5cab7 (diff) |
Debug print on key mismatch in cookie.
-rw-r--r-- | dht/HandshakeCache.hs | 4 | ||||
-rw-r--r-- | 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 | |||
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) | |||
122 | nodeInfo nid (SessionUDP :=> Identity saddr) = fmap (UDP ==>) $ UDP.nodeInfo nid saddr | 122 | nodeInfo nid (SessionUDP :=> Identity saddr) = fmap (UDP ==>) $ UDP.nodeInfo nid saddr |
123 | nodeInfo nid (SessionTCP :=> Identity taddr@(ViaRelay _ nid2 _)) = | 123 | nodeInfo 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 | ||
127 | nodeId :: DSum T Identity -> NodeId | 127 | nodeId :: DSum T Identity -> NodeId |
128 | nodeId (UDP :=> Identity ni ) = UDP.nodeId ni | 128 | nodeId (UDP :=> Identity ni ) = UDP.nodeId ni |