summaryrefslogtreecommitdiff
path: root/Connection/Tox.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-06-16 03:49:06 -0400
committerjoe <joe@jerkface.net>2018-06-16 03:49:06 -0400
commitc65f59c83c787e14efb5a58d32807b3bcb300de5 (patch)
treef669032ec1544bc3484b6275c32f21f4d64384b4 /Connection/Tox.hs
parent0a0e9b4d2f3935739c828e43577f84f435fecc73 (diff)
tox: Oops, fix endless blocking IO action in persueContact.
Diffstat (limited to 'Connection/Tox.hs')
-rw-r--r--Connection/Tox.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/Connection/Tox.hs b/Connection/Tox.hs
index 1fe07f82..2c485edd 100644
--- a/Connection/Tox.hs
+++ b/Connection/Tox.hs
@@ -66,10 +66,10 @@ data StatefulTask st = StatefulTask
66 , taskState :: TVar st 66 , taskState :: TVar st
67 } 67 }
68 68
69launch :: String -> st -> ((st -> STM ()) -> IO ()) -> IO (StatefulTask st) 69launch :: String -> st -> (TVar st -> IO ()) -> IO (StatefulTask st)
70launch lbl st f = do 70launch lbl st f = do
71 stvar <- newTVarIO st 71 stvar <- newTVarIO st
72 tid <- forkIO (f $ writeTVar stvar) 72 tid <- forkIO (f stvar)
73 labelThread tid lbl 73 labelThread tid lbl
74 return $ StatefulTask tid stvar 74 return $ StatefulTask tid stvar
75 75
@@ -128,9 +128,7 @@ setToxPolicy params conmap k policy = case policy of
128 , transitionToState = (\_ -> return ()) :: G.Status ToxProgress -> STM () 128 , transitionToState = (\_ -> return ()) :: G.Status ToxProgress -> STM ()
129 } 129 }
130 persue_methods = PersueContactMethods 130 persue_methods = PersueContactMethods
131 { getHandshakeParams = retry -- :: STM params 131 { -- TODO
132 , sendHandshake = \_ -> return () -- :: params -> IO ()
133 , retryInterval = _todo :: Int
134 } 132 }
135 freshen_methods = FreshenContactMethods 133 freshen_methods = FreshenContactMethods
136 { dhtkeyInterval = _todo :: Int 134 { dhtkeyInterval = _todo :: Int
@@ -181,10 +179,12 @@ setToxPolicy params conmap k policy = case policy of
181 OpenToConnect -> do -- passively accept connections if they initiate. 179 OpenToConnect -> do -- passively accept connections if they initiate.
182 mst <- lookupForPolicyChange conmap k policy 180 mst <- lookupForPolicyChange conmap k policy
183 forM_ mst $ \st -> do 181 forM_ mst $ \st -> do
182 {-
184 let getPolicy = readTVar $ connPolicy st 183 let getPolicy = readTVar $ connPolicy st
185 accept_thread <- launch ("accept:"++show k) 184 accept_thread <- launch ("accept:"++show k)
186 (G.InProgress $ toEnum 0) 185 (G.InProgress $ toEnum 0)
187 $ acceptContact getPolicy _accept_methods 186 $ acceptContact getPolicy _accept_methods
187 -}
188 atomically $ do 188 atomically $ do
189 let routing = dhtRouting params 189 let routing = dhtRouting params
190 Key _ nid = k 190 Key _ nid = k