summaryrefslogtreecommitdiff
path: root/dht/Presence
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2019-10-18 10:13:55 +0000
committerJoe Crayne <joe@jerkface.net>2020-01-01 19:53:31 -0500
commitc479c2dd58c12d159c05040a08da6c4c7730c407 (patch)
tree8f675cba6fc0fcb318078863589a083d2146caf4 /dht/Presence
parentc25b96d0665f9bd6c28245c811cbc7c57d0b9694 (diff)
convert forkIO to forkLabeled (wip)
Diffstat (limited to 'dht/Presence')
-rw-r--r--dht/Presence/XMPPServer.hs18
1 files changed, 8 insertions, 10 deletions
diff --git a/dht/Presence/XMPPServer.hs b/dht/Presence/XMPPServer.hs
index de2dd5d3..272f6efe 100644
--- a/dht/Presence/XMPPServer.hs
+++ b/dht/Presence/XMPPServer.hs
@@ -954,7 +954,7 @@ forkConnection sv xmpp saddr cdta pingflag src snk stanzas pp_mvar = do
954 "." -> show saddr 954 "." -> show saddr
955 mytoxname -> show saddr {- TODO: remote tox peer name? -} ] 955 mytoxname -> show saddr {- TODO: remote tox peer name? -} ]
956 956
957 forkIO $ do myThreadId >>= flip labelThread (lbl "xmpp-post.") 957 forkLabeled (lbl "xmpp-post.") $ do
958 -- This thread handles messages after they are pulled out of 958 -- This thread handles messages after they are pulled out of
959 -- the slots-queue. Hence, xmpp-post, for post- slots-queue. 959 -- the slots-queue. Hence, xmpp-post, for post- slots-queue.
960 960
@@ -991,12 +991,11 @@ forkConnection sv xmpp saddr cdta pingflag src snk stanzas pp_mvar = do
991 output <- atomically newTChan 991 output <- atomically newTChan
992 hacks <- atomically $ newTVar Map.empty 992 hacks <- atomically $ newTVar Map.empty
993 msgids <- atomically $ newTVar [] 993 msgids <- atomically $ newTVar []
994 forkIO $ do 994 forkLabeled (lbl "xmpp-pre.") $ do
995 -- Here is the pre- slots-queue thread which handles messages as they 995 -- Here is the pre- slots-queue thread which handles messages as they
996 -- arrive and assigns slots to them if that is appropriate. 996 -- arrive and assigns slots to them if that is appropriate.
997 997
998 -- mapM_ (atomically . Slotted.push slots Nothing) greetPeer 998 -- mapM_ (atomically . Slotted.push slots Nothing) greetPeer
999 myThreadId >>= flip labelThread (lbl "xmpp-pre.")
1000 999
1001 verbosity <- xmppVerbosity xmpp 1000 verbosity <- xmppVerbosity xmpp
1002 fix $ \loop -> do 1001 fix $ \loop -> do
@@ -1073,8 +1072,7 @@ forkConnection sv xmpp saddr cdta pingflag src snk stanzas pp_mvar = do
1073 ] 1072 ]
1074 what 1073 what
1075 wlog $ "end xmpp-pre fork: " ++ show (lbl "") 1074 wlog $ "end xmpp-pre fork: " ++ show (lbl "")
1076 forkIO $ do 1075 forkLabeled (lbl "xmpp-reader.") $ do
1077 myThreadId >>= flip labelThread (lbl "xmpp-reader.")
1078 -- src $$ awaitForever (lift . putStrLn . takeWhile (/=' ') . show) 1076 -- src $$ awaitForever (lift . putStrLn . takeWhile (/=' ') . show)
1079 runConduit $ src .| xmppInbound cdta clientOrServer pingflag stanzas output rdone 1077 runConduit $ src .| xmppInbound cdta clientOrServer pingflag stanzas output rdone
1080 atomically $ putTMVar rdone () 1078 atomically $ putTMVar rdone ()
@@ -1319,9 +1317,9 @@ monitor sv params xmpp = do
1319 -} 1317 -}
1320 dup <- cloneStanza stanza 1318 dup <- cloneStanza stanza
1321 1319
1322 t <- forkIO $ do applyStanza sv joined_rooms quitVar xmpp stanza 1320 forkLabeled ("process." ++ stanzaTypeString stanza) $ do
1323 forwardStanza quitVar xmpp stanza 1321 applyStanza sv joined_rooms quitVar xmpp stanza
1324 labelThread t $ "process." ++ stanzaTypeString stanza 1322 forwardStanza quitVar xmpp stanza
1325 1323
1326 -- We need to clone in the case the stanza is passed on as for Message. 1324 -- We need to clone in the case the stanza is passed on as for Message.
1327 wantStanzas <- getVerbose XJabber 1325 wantStanzas <- getVerbose XJabber
@@ -1795,8 +1793,8 @@ forkXmpp XMPPServer { _xmpp_sv = sv
1795 { pingInterval = 0 1793 { pingInterval = 0
1796 , timeout = 0 1794 , timeout = 0
1797 } 1795 }
1798 mt <- forkIO $ do myThreadId >>= flip labelThread ("XMPP.monitor") 1796 mt <- forkLabeled "XMPP.monitor" $ do
1799 monitor sv peer_params xmpp 1797 monitor sv peer_params xmpp
1800 dput XMisc $ "Starting peer listen" 1798 dput XMisc $ "Starting peer listen"
1801 control sv (Listen peer_bind peer_params) 1799 control sv (Listen peer_bind peer_params)
1802 dput XMisc $ "Starting client listen" 1800 dput XMisc $ "Starting client listen"