summaryrefslogtreecommitdiff
path: root/Connection/Tox/Threads.hs
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2018-06-24 05:02:34 -0400
committerAndrew Cady <d@jerkface.net>2018-06-24 06:40:09 -0400
commitc781c88c3cd77b70694a26c3f27ff82aa6fa65d3 (patch)
tree02b8e3635677f073eb959a8f6224e98ad85993ac /Connection/Tox/Threads.hs
parent4c045e987892a0b32d86a93f0f521f497213341e (diff)
Fixed handshake behavior
The handshake code would flood the network with interminable handshakes.
Diffstat (limited to 'Connection/Tox/Threads.hs')
-rw-r--r--Connection/Tox/Threads.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/Connection/Tox/Threads.hs b/Connection/Tox/Threads.hs
index ba49b7dc..de719655 100644
--- a/Connection/Tox/Threads.hs
+++ b/Connection/Tox/Threads.hs
@@ -140,7 +140,7 @@ pursueContact getPolicy getStatus PursueContactMethods{..} statusVar = do
140 (do 140 (do
141 (stamp_theirDhtKey,theirDhtKey) <- second DHT.dhtpk <$> retryUntilJust (contactKeyPacket contact) 141 (stamp_theirDhtKey,theirDhtKey) <- second DHT.dhtpk <$> retryUntilJust (contactKeyPacket contact)
142 (stamp_saddr,saddr) <- retryUntilJust (contactLastSeenAddr contact) 142 (stamp_saddr,saddr) <- retryUntilJust (contactLastSeenAddr contact)
143 ni <- either (const retry) return $ nodeInfo (key2id theirDhtKey) saddr 143 ni <- either (const retry) return $ nodeInfo (key2id theirDhtKey) (_fixme saddr)
144 return $ do 144 return $ do
145 -- AcquiringCookie 145 -- AcquiringCookie
146 atomically $ writeTVar statusVar (InProgress AcquiringCookie) 146 atomically $ writeTVar statusVar (InProgress AcquiringCookie)
@@ -166,11 +166,11 @@ pursueContact getPolicy getStatus PursueContactMethods{..} statusVar = do
166 newsession <- generateSecretKey 166 newsession <- generateSecretKey
167 timestamp <- getPOSIXTime 167 timestamp <- getPOSIXTime
168 (myhandshake,ioAction) 168 (myhandshake,ioAction)
169 <- atomically $ freshCryptoSession allsessions saddr newsession timestamp hp 169 <- atomically $ freshCryptoSession allsessions (_fixme saddr) newsession timestamp hp
170 ioAction 170 ioAction
171 -- send handshake 171 -- send handshake
172 forM myhandshake $ \response_handshake -> do 172 forM myhandshake $ \response_handshake -> do
173 sendHandshake allsessions saddr response_handshake 173 sendHandshake allsessions (_fixme saddr) response_handshake
174 atomically $ writeTVar statusVar $ InProgress AwaitingHandshake 174 atomically $ writeTVar statusVar $ InProgress AwaitingHandshake
175 return shortRetryInterval 175 return shortRetryInterval
176 -- AwaitingHandshake 176 -- AwaitingHandshake