diff options
author | Joe Crayne <joe@jerkface.net> | 2020-01-07 13:18:57 -0500 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2020-01-07 13:24:59 -0500 |
commit | b2a3bbf92c67b87e491e3d8187577110e7de57fb (patch) | |
tree | 59fd8c5a022c4366799d990ad670180dee7bc9be | |
parent | c6bcfc88986d56d0495315d46d4c8277b7425029 (diff) |
Added standalone leak test for toxToXmpp.
-rw-r--r-- | dht/examples/leaktest.hs | 31 |
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 #-} | ||
2 | import Conduit as C | ||
3 | import qualified Data.Conduit.List as CL | ||
4 | import Data.Dependent.Sum | ||
5 | import Data.Function | ||
6 | import Data.Text (Text) | ||
7 | import Data.XML.Types as XML | ||
8 | |||
9 | import Crypto.Tox | ||
10 | import Data.Tox.Msg as Tox | ||
11 | import Network.Tox.NodeId | ||
12 | import ToxToXMPP | ||
13 | import Network.Address | ||
14 | |||
15 | storeInvite :: Monad m => Int -> Maybe Text -> Invite -> m () | ||
16 | storeInvite _ _ _ = return () | ||
17 | |||
18 | me :: PublicKey | ||
19 | me = id2key $ read "mb8x36b1oxgj1shbdy6dfj96pu6hdruy6cc49ykzdd3fb6wguwfe" | ||
20 | |||
21 | them :: PublicKey | ||
22 | them = id2key $ read "y4t5janwehaqb9ayc57cgxzc1c4hrmdzuybj6yatskhx8bdp1cys" | ||
23 | |||
24 | pipe :: Monad m => ConduitM (Int,Tox.CryptoMessage) XML.Event m () | ||
25 | pipe = toxToXmpp storeInvite localhost4 me (xmppHostname them) | ||
26 | |||
27 | onlines = CL.replicate 50000 (1, Pkt USERSTATUS ==> Online) | ||
28 | |||
29 | main = do | ||
30 | runConduit $ onlines .| pipe .| CL.mapM_ print | ||
31 | return () | ||