diff options
author | jim@bo <jim@bo> | 2018-06-20 22:40:37 -0400 |
---|---|---|
committer | jim@bo <jim@bo> | 2018-06-20 22:43:47 -0400 |
commit | 825962518c6ad00279fc23e8e1dec746980e483f (patch) | |
tree | 68c135bdffd879835c48cce3d397e8edf99b53f4 /Connection/Tox.hs | |
parent | 09aa079fbab069f177e08b5239bf684d312eb00a (diff) |
More DPut stuff
* verbose/quiet without args shows report
* verbose all - sets all tags verbose
* quiet all - sets all tags quiet
* XMisc defaults to verbose, everything else quiet
* new XMan tag for ToxManager related stuff
* s/hputStrLn stderr/dput XMisc/ in daemon code
Diffstat (limited to 'Connection/Tox.hs')
-rw-r--r-- | Connection/Tox.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Connection/Tox.hs b/Connection/Tox.hs index 03ffbc25..1cbbdaee 100644 --- a/Connection/Tox.hs +++ b/Connection/Tox.hs | |||
@@ -31,6 +31,7 @@ import GHC.Conc (labelThread) | |||
31 | #endif | 31 | #endif |
32 | import GHC.Conc (ThreadStatus (..), threadStatus) | 32 | import GHC.Conc (ThreadStatus (..), threadStatus) |
33 | import System.IO | 33 | import System.IO |
34 | import DPut | ||
34 | 35 | ||
35 | 36 | ||
36 | 37 | ||
@@ -81,7 +82,7 @@ launch lbl st f = do | |||
81 | tid <- forkIO (f stvar) | 82 | tid <- forkIO (f stvar) |
82 | labelThread tid lbl | 83 | labelThread tid lbl |
83 | stat <- threadStatus tid | 84 | stat <- threadStatus tid |
84 | hPutStrLn stderr $ "launch "++lbl++" "++show stat | 85 | dput XMan $ "launch "++lbl++" "++show stat |
85 | return $ StatefulTask tid stvar | 86 | return $ StatefulTask tid stvar |
86 | 87 | ||
87 | 88 | ||
@@ -142,12 +143,12 @@ setToxPolicy :: Parameters extra | |||
142 | -> Policy | 143 | -> Policy |
143 | -> IO () | 144 | -> IO () |
144 | setToxPolicy params conmap k@(Key me them) policy = do | 145 | setToxPolicy params conmap k@(Key me them) policy = do |
145 | hPutStrLn stderr $ "C.setToxPolicy "++show (them,policy) | 146 | dput XMan $ "C.setToxPolicy "++show (them,policy) |
146 | case policy of | 147 | case policy of |
147 | TryingToConnect -> do | 148 | TryingToConnect -> do |
148 | mst <- lookupForPolicyChange conmap k policy | 149 | mst <- lookupForPolicyChange conmap k policy |
149 | r <- atomically $ lookupContact k (roster params) | 150 | r <- atomically $ lookupContact k (roster params) |
150 | hPutStrLn stderr $ "C.r="++show (fmap (const ()) r) | 151 | dput XMan $ "C.r="++show (fmap (const ()) r) |
151 | forM_ r $ \(sec,c) -> do | 152 | forM_ r $ \(sec,c) -> do |
152 | let persue_methods = PersueContactMethods | 153 | let persue_methods = PersueContactMethods |
153 | { allsessions = sessions params | 154 | { allsessions = sessions params |
@@ -178,7 +179,7 @@ setToxPolicy params conmap k@(Key me them) policy = do | |||
178 | fmap (fromMaybe G.Dormant) $ forM (Map.lookup (id2key them) sbk) $ \ss -> do | 179 | fmap (fromMaybe G.Dormant) $ forM (Map.lookup (id2key them) sbk) $ \ss -> do |
179 | stats <- mapM (readTVar . ncState) ss | 180 | stats <- mapM (readTVar . ncState) ss |
180 | return $ maximum stats | 181 | return $ maximum stats |
181 | hPutStrLn stderr $ "C.mst="++show (fmap (const ()) mst) | 182 | dput XMan $ "C.mst="++show (fmap (const ()) mst) |
182 | forM_ mst $ \st -> do | 183 | forM_ mst $ \st -> do |
183 | let getPolicy = readTVar $ connPolicy st | 184 | let getPolicy = readTVar $ connPolicy st |
184 | tasks <- atomically $ readTVar (handshakeTask st) | 185 | tasks <- atomically $ readTVar (handshakeTask st) |