From 07b1494c9d5c692371c9689a8f78f4cf7ee58732 Mon Sep 17 00:00:00 2001 From: joe Date: Mon, 18 Jun 2018 00:49:38 -0400 Subject: Tox: Added timestamps to dhtkey and sockaddr information. --- Connection/Tox.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Connection/Tox.hs') diff --git a/Connection/Tox.hs b/Connection/Tox.hs index 7b304050..0c2f281f 100644 --- a/Connection/Tox.hs +++ b/Connection/Tox.hs @@ -192,12 +192,12 @@ setToxPolicy params conmap k@(Key me them) policy = do registerNodeCallback routing $ NodeInfoCallback { interestingNodeId = nid , listenerId = callbackId - , observedAddress = \ni -> writeTVar (contactLastSeenAddr c) (Just $ nodeAddr ni) - , rumoredAddress = \saddr ni -> do + , observedAddress = \now ni -> writeTVar (contactLastSeenAddr c) (Just (now,nodeAddr ni)) + , rumoredAddress = \now saddr ni -> do m <- readTVar (contactLastSeenAddr c) -- TODO remember information source and handle multiple rumors. case m of Just _ -> return () - Nothing -> writeTVar (contactLastSeenAddr c) (Just $ nodeAddr ni) + Nothing -> writeTVar (contactLastSeenAddr c) (Just (now,nodeAddr ni)) } return () RefusingToConnect -> do -- disconnect or cancel any pending connection @@ -234,12 +234,12 @@ setToxPolicy params conmap k@(Key me them) policy = do registerNodeCallback routing $ NodeInfoCallback { interestingNodeId = nid , listenerId = callbackId - , observedAddress = \ni -> writeTVar (contactLastSeenAddr c) (Just $ nodeAddr ni) - , rumoredAddress = \saddr ni -> do + , observedAddress = \now ni -> writeTVar (contactLastSeenAddr c) (Just (now,nodeAddr ni)) + , rumoredAddress = \now saddr ni -> do m <- readTVar (contactLastSeenAddr c) -- TODO remember information source and handle multiple rumors. case m of Just _ -> return () - Nothing -> writeTVar (contactLastSeenAddr c) (Just $ nodeAddr ni) + Nothing -> writeTVar (contactLastSeenAddr c) (Just (now,nodeAddr ni)) } stringToKey_ :: String -> Maybe Key -- cgit v1.2.3