From 87b3f98435ea74abfa72e120eca5940bb2974831 Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Fri, 7 Sep 2018 11:38:07 -0400 Subject: xmpp: cache stream name --- examples/dhtd.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'examples') diff --git a/examples/dhtd.hs b/examples/dhtd.hs index cdaa73ed..db8664e8 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs @@ -1576,9 +1576,11 @@ announceToxJabberPeer :: PublicKey -- ^ This node's long-term user key. -> IO (Maybe (Tox.NetCryptoSession -> Tox.NetCryptoSession)) announceToxJabberPeer me them echan laddr saddr pingflag tsrc tsnk = do - atomically $ writeTChan echan - ( (saddr, ConnectionData (Left (Local laddr)) XMPPServer.Tox (xmppHostname me) ) - , Tcp.Connection pingflag xsrc xsnk ) + atomically $ do + v <- newTVar Nothing + writeTChan echan + ( (saddr, ConnectionData (Left (Local laddr)) XMPPServer.Tox (xmppHostname me) v) + , Tcp.Connection pingflag xsrc xsnk ) return Nothing where xsrc = tsrc =$= toxToXmpp laddr me (xmppHostname them) -- cgit v1.2.3