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/Threads.hs | |
parent | 6de7e6d299254010ebe2fd3fc5fb7c7fd6c89fc6 (diff) |
Tox: Added timestamps to dhtkey and sockaddr information.
Diffstat (limited to 'Connection/Tox/Threads.hs')
-rw-r--r-- | Connection/Tox/Threads.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Connection/Tox/Threads.hs b/Connection/Tox/Threads.hs index 5602fa40..a5a839f9 100644 --- a/Connection/Tox/Threads.hs +++ b/Connection/Tox/Threads.hs | |||
@@ -32,6 +32,7 @@ import Control.Concurrent.Lifted | |||
32 | import GHC.Conc (labelThread) | 32 | import GHC.Conc (labelThread) |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | import Control.Arrow | ||
35 | import Control.Concurrent.STM | 36 | import Control.Concurrent.STM |
36 | import Control.Monad | 37 | import Control.Monad |
37 | import Data.Function | 38 | import Data.Function |
@@ -124,15 +125,15 @@ persueContact getPolicy getStatus PersueContactMethods{..} statusVar = do | |||
124 | $ \retryAfterTimeout -> | 125 | $ \retryAfterTimeout -> |
125 | orElse (do | 126 | orElse (do |
126 | readTVar statusVar >>= check . (/= InProgress AcquiringIPAddress) | 127 | readTVar statusVar >>= check . (/= InProgress AcquiringIPAddress) |
127 | theirDhtKey <- DHT.dhtpk <$> retryUntilJust (contactKeyPacket contact) | 128 | (stamp_theirDhtKey,theirDhtKey) <- second DHT.dhtpk <$> retryUntilJust (contactKeyPacket contact) |
128 | -- We don't have an IP address yet. | 129 | -- We don't have an IP address yet. |
129 | maybe (return ()) (const retry) =<< readTVar (contactLastSeenAddr contact) | 130 | maybe (return ()) (const retry) =<< readTVar (contactLastSeenAddr contact) |
130 | return $ do -- AcquiringIPAddress | 131 | return $ do -- AcquiringIPAddress |
131 | atomically $ writeTVar statusVar (InProgress AcquiringIPAddress) | 132 | atomically $ writeTVar statusVar (InProgress AcquiringIPAddress) |
132 | retryAfterTimeout 0) | 133 | retryAfterTimeout 0) |
133 | (do | 134 | (do |
134 | theirDhtKey <- DHT.dhtpk <$> retryUntilJust (contactKeyPacket contact) | 135 | (stamp_theirDhtKey,theirDhtKey) <- second DHT.dhtpk <$> retryUntilJust (contactKeyPacket contact) |
135 | saddr <- retryUntilJust (contactLastSeenAddr contact) | 136 | (stamp_saddr,saddr) <- retryUntilJust (contactLastSeenAddr contact) |
136 | ni <- either (const retry) return $ nodeInfo (key2id theirDhtKey) saddr | 137 | ni <- either (const retry) return $ nodeInfo (key2id theirDhtKey) saddr |
137 | return $ do | 138 | return $ do |
138 | -- AcquiringCookie | 139 | -- AcquiringCookie |