summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-11-17 14:41:53 -0500
committerjoe <joe@jerkface.net>2017-11-17 14:41:53 -0500
commit5191d7c488462afd4d97e46865b83e939552c4dd (patch)
tree816b674880d21ef77c282d453aa57fce631b3e8d /examples
parent4219114282dea03301a7d09817d6210baef1791d (diff)
Generic connection manager for Tox and XMPP.
Diffstat (limited to 'examples')
-rw-r--r--examples/dhtd.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs
index 4c0cd114..abf0c297 100644
--- a/examples/dhtd.hs
+++ b/examples/dhtd.hs
@@ -1353,8 +1353,9 @@ main = do
1353 return () 1353 return ()
1354 1354
1355 -- XMPP initialization 1355 -- XMPP initialization
1356 cw <- newConsoleWriter 1356 cw <- newConsoleWriter
1357 state <- newPresenceState cw 1357 serverVar <- atomically $ newEmptyTMVar
1358 state <- newPresenceState cw serverVar
1358 1359
1359 -- XMPP stanza handling 1360 -- XMPP stanza handling
1360 runResourceT $ do 1361 runResourceT $ do
@@ -1363,8 +1364,10 @@ main = do
1363 -- we put it into the 'server' field of our /state/ record. 1364 -- we put it into the 'server' field of our /state/ record.
1364 1365
1365 liftIO $ do 1366 liftIO $ do
1366 atomically $ putTMVar (server state) sv -- Okay, now it's ready. :) 1367 conns <- xmppConnections sv
1367 -- FIXME: This is error prone. 1368 atomically $ do
1369 putTMVar serverVar (sv,conns) -- Okay, now it's ready. :)
1370 -- FIXME: This is error prone.
1368 1371
1369 forkIO $ do 1372 forkIO $ do
1370 myThreadId >>= flip labelThread "XMPP.stanzas" 1373 myThreadId >>= flip labelThread "XMPP.stanzas"