diff options
Diffstat (limited to 'Connection/Tox/Threads.hs')
-rw-r--r-- | Connection/Tox/Threads.hs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Connection/Tox/Threads.hs b/Connection/Tox/Threads.hs index f3357215..73c83338 100644 --- a/Connection/Tox/Threads.hs +++ b/Connection/Tox/Threads.hs | |||
@@ -116,15 +116,12 @@ persueContact getPolicy getStatus PersueContactMethods{..} statusVar = do | |||
116 | whileTryingAndNotEstablished getPolicy getStatus statusVar | 116 | whileTryingAndNotEstablished getPolicy getStatus statusVar |
117 | $ \retryAfterTimeout -> | 117 | $ \retryAfterTimeout -> |
118 | orElse (do | 118 | orElse (do |
119 | readTVar statusVar >>= check . (/= InProgress AcquiringIPAddress) | ||
119 | theirDhtKey <- DHT.dhtpk <$> retryUntilJust (contactKeyPacket contact) | 120 | theirDhtKey <- DHT.dhtpk <$> retryUntilJust (contactKeyPacket contact) |
120 | -- We don't have an IP address yet. | 121 | -- We don't have an IP address yet. |
121 | maybe (return ()) (const retry) =<< readTVar (contactLastSeenAddr contact) | 122 | maybe (return ()) (const retry) =<< readTVar (contactLastSeenAddr contact) |
122 | return $ do -- AcquiringIPAddress | 123 | return $ do -- AcquiringIPAddress |
123 | atomically $ do | 124 | atomically $ writeTVar statusVar (InProgress AcquiringIPAddress) |
124 | status <- readTVar statusVar | ||
125 | if status == InProgress AcquiringIPAddress | ||
126 | then retry | ||
127 | else writeTVar statusVar (InProgress AcquiringIPAddress) | ||
128 | retryAfterTimeout 0) | 125 | retryAfterTimeout 0) |
129 | (do | 126 | (do |
130 | theirDhtKey <- DHT.dhtpk <$> retryUntilJust (contactKeyPacket contact) | 127 | theirDhtKey <- DHT.dhtpk <$> retryUntilJust (contactKeyPacket contact) |