summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2020-01-07 13:18:57 -0500
committerJoe Crayne <joe@jerkface.net>2020-01-07 13:24:59 -0500
commitb2a3bbf92c67b87e491e3d8187577110e7de57fb (patch)
tree59fd8c5a022c4366799d990ad670180dee7bc9be
parentc6bcfc88986d56d0495315d46d4c8277b7425029 (diff)
Added standalone leak test for toxToXmpp.
-rw-r--r--dht/examples/leaktest.hs31
1 files changed, 31 insertions, 0 deletions
diff --git a/dht/examples/leaktest.hs b/dht/examples/leaktest.hs
new file mode 100644
index 00000000..18c16c29
--- /dev/null
+++ b/dht/examples/leaktest.hs
@@ -0,0 +1,31 @@
1{-# LANGUAGE NoMonomorphismRestriction #-}
2import Conduit as C
3import qualified Data.Conduit.List as CL
4import Data.Dependent.Sum
5import Data.Function
6import Data.Text (Text)
7import Data.XML.Types as XML
8
9import Crypto.Tox
10import Data.Tox.Msg as Tox
11import Network.Tox.NodeId
12import ToxToXMPP
13import Network.Address
14
15storeInvite :: Monad m => Int -> Maybe Text -> Invite -> m ()
16storeInvite _ _ _ = return ()
17
18me :: PublicKey
19me = id2key $ read "mb8x36b1oxgj1shbdy6dfj96pu6hdruy6cc49ykzdd3fb6wguwfe"
20
21them :: PublicKey
22them = id2key $ read "y4t5janwehaqb9ayc57cgxzc1c4hrmdzuybj6yatskhx8bdp1cys"
23
24pipe :: Monad m => ConduitM (Int,Tox.CryptoMessage) XML.Event m ()
25pipe = toxToXmpp storeInvite localhost4 me (xmppHostname them)
26
27onlines = CL.replicate 50000 (1, Pkt USERSTATUS ==> Online)
28
29main = do
30 runConduit $ onlines .| pipe .| CL.mapM_ print
31 return ()