diff options
author | joe <joe@jerkface.net> | 2018-06-18 00:49:38 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2018-06-18 00:49:38 -0400 |
commit | 07b1494c9d5c692371c9689a8f78f4cf7ee58732 (patch) | |
tree | aac158efc14bdb210717018704c43f2542804bf8 /Connection/Tox.hs | |
parent | 6de7e6d299254010ebe2fd3fc5fb7c7fd6c89fc6 (diff) |
Tox: Added timestamps to dhtkey and sockaddr information.
Diffstat (limited to 'Connection/Tox.hs')
-rw-r--r-- | Connection/Tox.hs | 12 |
1 files changed, 6 insertions, 6 deletions
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 | |||
192 | registerNodeCallback routing $ NodeInfoCallback | 192 | registerNodeCallback routing $ NodeInfoCallback |
193 | { interestingNodeId = nid | 193 | { interestingNodeId = nid |
194 | , listenerId = callbackId | 194 | , listenerId = callbackId |
195 | , observedAddress = \ni -> writeTVar (contactLastSeenAddr c) (Just $ nodeAddr ni) | 195 | , observedAddress = \now ni -> writeTVar (contactLastSeenAddr c) (Just (now,nodeAddr ni)) |
196 | , rumoredAddress = \saddr ni -> do | 196 | , rumoredAddress = \now saddr ni -> do |
197 | m <- readTVar (contactLastSeenAddr c) | 197 | m <- readTVar (contactLastSeenAddr c) |
198 | -- TODO remember information source and handle multiple rumors. | 198 | -- TODO remember information source and handle multiple rumors. |
199 | case m of Just _ -> return () | 199 | case m of Just _ -> return () |
200 | Nothing -> writeTVar (contactLastSeenAddr c) (Just $ nodeAddr ni) | 200 | Nothing -> writeTVar (contactLastSeenAddr c) (Just (now,nodeAddr ni)) |
201 | } | 201 | } |
202 | return () | 202 | return () |
203 | RefusingToConnect -> do -- disconnect or cancel any pending connection | 203 | RefusingToConnect -> do -- disconnect or cancel any pending connection |
@@ -234,12 +234,12 @@ setToxPolicy params conmap k@(Key me them) policy = do | |||
234 | registerNodeCallback routing $ NodeInfoCallback | 234 | registerNodeCallback routing $ NodeInfoCallback |
235 | { interestingNodeId = nid | 235 | { interestingNodeId = nid |
236 | , listenerId = callbackId | 236 | , listenerId = callbackId |
237 | , observedAddress = \ni -> writeTVar (contactLastSeenAddr c) (Just $ nodeAddr ni) | 237 | , observedAddress = \now ni -> writeTVar (contactLastSeenAddr c) (Just (now,nodeAddr ni)) |
238 | , rumoredAddress = \saddr ni -> do | 238 | , rumoredAddress = \now saddr ni -> do |
239 | m <- readTVar (contactLastSeenAddr c) | 239 | m <- readTVar (contactLastSeenAddr c) |
240 | -- TODO remember information source and handle multiple rumors. | 240 | -- TODO remember information source and handle multiple rumors. |
241 | case m of Just _ -> return () | 241 | case m of Just _ -> return () |
242 | Nothing -> writeTVar (contactLastSeenAddr c) (Just $ nodeAddr ni) | 242 | Nothing -> writeTVar (contactLastSeenAddr c) (Just (now,nodeAddr ni)) |
243 | } | 243 | } |
244 | 244 | ||
245 | stringToKey_ :: String -> Maybe Key | 245 | stringToKey_ :: String -> Maybe Key |