summaryrefslogtreecommitdiff
path: root/Connection
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2018-06-23 19:46:34 -0400
committerAndrew Cady <d@jerkface.net>2018-06-23 19:46:34 -0400
commit02cac92ab79526cdbec7313b34e30b2b2a13ef16 (patch)
treea3dc0124dd62286673de5ab710289bf94cb27efc /Connection
parent3594f51aa4834b546440228d863c2a8d9ec884d6 (diff)
spelling
Diffstat (limited to 'Connection')
-rw-r--r--Connection/Tox.hs6
-rw-r--r--Connection/Tox/Threads.hs18
2 files changed, 12 insertions, 12 deletions
diff --git a/Connection/Tox.hs b/Connection/Tox.hs
index 56777e99..3f5f7e2c 100644
--- a/Connection/Tox.hs
+++ b/Connection/Tox.hs
@@ -150,7 +150,7 @@ setToxPolicy params conmap k@(Key me them) policy = do
150 r <- atomically $ lookupContact k (roster params) 150 r <- atomically $ lookupContact k (roster params)
151 dput XMan $ "C.r="++show (fmap (const ()) r) 151 dput XMan $ "C.r="++show (fmap (const ()) r)
152 forM_ r $ \(sec,c) -> do 152 forM_ r $ \(sec,c) -> do
153 let persue_methods = PersueContactMethods 153 let pursue_methods = PursueContactMethods
154 { allsessions = sessions params 154 { allsessions = sessions params
155 , myseckey = sec 155 , myseckey = sec
156 , theirpubkey = id2key them 156 , theirpubkey = id2key them
@@ -183,9 +183,9 @@ setToxPolicy params conmap k@(Key me them) policy = do
183 forM_ mst $ \st -> do 183 forM_ mst $ \st -> do
184 let getPolicy = readTVar $ connPolicy st 184 let getPolicy = readTVar $ connPolicy st
185 tasks <- atomically $ readTVar (handshakeTask st) 185 tasks <- atomically $ readTVar (handshakeTask st)
186 persuing <- launch ("persue:"++show k) 186 persuing <- launch ("pursue:"++show k)
187 (G.InProgress $ toEnum 0) 187 (G.InProgress $ toEnum 0)
188 $ persueContact getPolicy get_status persue_methods 188 $ pursueContact getPolicy get_status pursue_methods
189 atomically $ do 189 atomically $ do
190 writeTVar (handshakeTask st) $ persuing 190 writeTVar (handshakeTask st) $ persuing
191 let routing = dhtRouting params 191 let routing = dhtRouting params
diff --git a/Connection/Tox/Threads.hs b/Connection/Tox/Threads.hs
index f3c94fc1..ba49b7dc 100644
--- a/Connection/Tox/Threads.hs
+++ b/Connection/Tox/Threads.hs
@@ -4,16 +4,16 @@
4-- 4--
5-- * 'acceptContact' 5-- * 'acceptContact'
6-- 6--
7-- * 'persueContact' 7-- * 'pursueContact'
8-- 8--
9-- * 'freshenContact' 9-- * 'freshenContact'
10-- 10--
11{-# LANGUAGE CPP #-} 11{-# LANGUAGE CPP #-}
12{-# LANGUAGE LambdaCase #-} 12{-# LANGUAGE LambdaCase #-}
13module Connection.Tox.Threads 13module Connection.Tox.Threads
14 ( PersueContactMethods(..) 14 ( PursueContactMethods(..)
15 , FreshenContactMethods(..) 15 , FreshenContactMethods(..)
16 , persueContact 16 , pursueContact
17 ) where 17 ) where
18 18
19import Connection 19import Connection
@@ -101,7 +101,7 @@ whileTryingAndNotEstablished getPolicy getStatus statusVar body = fix $ \loop ->
101 (ifEstablished retry 101 (ifEstablished retry
102 (body retryAfterTimeout)) 102 (body retryAfterTimeout))
103 103
104data PersueContactMethods = PersueContactMethods 104data PursueContactMethods = PursueContactMethods
105 { allsessions :: NetCryptoSessions 105 { allsessions :: NetCryptoSessions
106 , myseckey :: SecretKey 106 , myseckey :: SecretKey
107 , theirpubkey :: PublicKey 107 , theirpubkey :: PublicKey
@@ -119,12 +119,12 @@ retryUntilJust tvar = maybe retry return =<< readTVar tvar
119-- 119--
120-- As long as getPolicy is TryingToConnect and there is no established 120-- As long as getPolicy is TryingToConnect and there is no established
121-- connection, this function will continue. 121-- connection, this function will continue.
122persueContact :: STM Policy 122pursueContact :: STM Policy
123 -> STM (Status t) 123 -> STM (Status t)
124 -> PersueContactMethods 124 -> PursueContactMethods
125 -> TVar (Status ToxProgress) 125 -> TVar (Status ToxProgress)
126 -> IO () 126 -> IO ()
127persueContact getPolicy getStatus PersueContactMethods{..} statusVar = do 127pursueContact getPolicy getStatus PursueContactMethods{..} statusVar = do
128 -- AwaitingDHTKey 128 -- AwaitingDHTKey
129 atomically $ writeTVar statusVar (InProgress AwaitingDHTKey) 129 atomically $ writeTVar statusVar (InProgress AwaitingDHTKey)
130 whileTryingAndNotEstablished getPolicy getStatus statusVar 130 whileTryingAndNotEstablished getPolicy getStatus statusVar
@@ -151,8 +151,8 @@ persueContact getPolicy getStatus PersueContactMethods{..} statusVar = do
151 DHT.cookieRequest crypto client (toPublic myseckey) ni 151 DHT.cookieRequest crypto client (toPublic myseckey) ni
152 interval <- case mbCookie of 152 interval <- case mbCookie of
153 Nothing -> do 153 Nothing -> do
154 dput XMan ("persueContact: (" ++ show mykeyAsId ++") <--> (" ++ show theirkeyAsId ++ ").") 154 dput XMan ("pursueContact: (" ++ show mykeyAsId ++") <--> (" ++ show theirkeyAsId ++ ").")
155 dput XMan ("persueContact: CookieRequest failed. TODO: dhtpkNodes thingy") 155 dput XMan ("pursueContact: CookieRequest failed. TODO: dhtpkNodes thingy")
156 return longRetryInterval 156 return longRetryInterval
157 Just cookie -> do 157 Just cookie -> do
158 dput XMan "Have cookie, creating handshake packet..." 158 dput XMan "Have cookie, creating handshake packet..."