summaryrefslogtreecommitdiff
path: root/dht/Presence/XMPPServer.hs
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2019-10-18 09:43:20 +0000
committerJoe Crayne <joe@jerkface.net>2020-01-01 19:52:45 -0500
commit5bde2cfe951577be3018b437619cd0e87ab20096 (patch)
tree3077430f036d44d856caa3ca65e9f7644102fee5 /dht/Presence/XMPPServer.hs
parent88cb351cb6ddfb5e80f247bea6cc503ed1e12baf (diff)
Control.Concurrent.ThreadUtil replaces #ifdef imports
* new function, forkLabeled * new module Control.Concurrent.ThreadUtil * label a few unlabeled threads
Diffstat (limited to 'dht/Presence/XMPPServer.hs')
-rw-r--r--dht/Presence/XMPPServer.hs11
1 files changed, 3 insertions, 8 deletions
diff --git a/dht/Presence/XMPPServer.hs b/dht/Presence/XMPPServer.hs
index e98b9a2e..de2dd5d3 100644
--- a/dht/Presence/XMPPServer.hs
+++ b/dht/Presence/XMPPServer.hs
@@ -65,12 +65,7 @@ import Control.Monad.Trans (lift)
65import Control.Monad.IO.Class (MonadIO, liftIO) 65import Control.Monad.IO.Class (MonadIO, liftIO)
66import Control.Monad.Fix (fix) 66import Control.Monad.Fix (fix)
67import Control.Monad 67import Control.Monad
68#ifdef THREAD_DEBUG 68import Control.Concurrent.ThreadUtil (forkIO,myThreadId,forkLabeled,labelThread,ThreadId,MVar,putMVar,takeMVar,newMVar)
69import Control.Concurrent.Lifted.Instrument (forkIO,myThreadId,labelThread,ThreadId,MVar,putMVar,takeMVar,newMVar)
70#else
71import Control.Concurrent.Lifted (forkIO,myThreadId,ThreadId)
72import GHC.Conc (labelThread)
73#endif
74import Control.Concurrent.STM 69import Control.Concurrent.STM
75import Data.List hiding ((\\)) 70import Data.List hiding ((\\))
76-- import Control.Concurrent.STM.TChan 71-- import Control.Concurrent.STM.TChan
@@ -344,7 +339,7 @@ conduitToChan c = do
344 chan <- atomically newLockedChan 339 chan <- atomically newLockedChan
345 clsrs <- atomically $ newTVar (Just []) 340 clsrs <- atomically $ newTVar (Just [])
346 quitvar <- atomically $ newEmptyTMVar 341 quitvar <- atomically $ newEmptyTMVar
347 forkIO $ do 342 forkLabeled "XMPP.conduitToChan" $ do
348 runConduit $ c .| copyToChannel id chan clsrs .| awaitForever (const $ return ()) 343 runConduit $ c .| copyToChannel id chan clsrs .| awaitForever (const $ return ())
349 atomically $ writeTVar clsrs Nothing 344 atomically $ writeTVar clsrs Nothing
350 return (chan,clsrs,quitvar) 345 return (chan,clsrs,quitvar)
@@ -462,7 +457,7 @@ sendReply donevar stype reply replychan = do
462 , stanzaOrigin = LocalPeer 457 , stanzaOrigin = LocalPeer
463 } 458 }
464 ioWriteChan replychan replyStanza 459 ioWriteChan replychan replyStanza
465 void . liftIO . forkIO $ do 460 void . liftIO . forkLabeled "XMPPServer.sendReply" $ do
466 mapM_ (liftIO . atomically . writeLChan (stanzaChan replyStanza)) reply 461 mapM_ (liftIO . atomically . writeLChan (stanzaChan replyStanza)) reply
467 liftIO . atomically $ writeTVar (stanzaClosers replyStanza) Nothing 462 liftIO . atomically $ writeTVar (stanzaClosers replyStanza) Nothing
468 -- liftIO $ wlog "finished reply stanza" 463 -- liftIO $ wlog "finished reply stanza"