From b2a3bbf92c67b87e491e3d8187577110e7de57fb Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Tue, 7 Jan 2020 13:18:57 -0500 Subject: Added standalone leak test for toxToXmpp. --- dht/examples/leaktest.hs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 dht/examples/leaktest.hs 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 @@ +{-# LANGUAGE NoMonomorphismRestriction #-} +import Conduit as C +import qualified Data.Conduit.List as CL +import Data.Dependent.Sum +import Data.Function +import Data.Text (Text) +import Data.XML.Types as XML + +import Crypto.Tox +import Data.Tox.Msg as Tox +import Network.Tox.NodeId +import ToxToXMPP +import Network.Address + +storeInvite :: Monad m => Int -> Maybe Text -> Invite -> m () +storeInvite _ _ _ = return () + +me :: PublicKey +me = id2key $ read "mb8x36b1oxgj1shbdy6dfj96pu6hdruy6cc49ykzdd3fb6wguwfe" + +them :: PublicKey +them = id2key $ read "y4t5janwehaqb9ayc57cgxzc1c4hrmdzuybj6yatskhx8bdp1cys" + +pipe :: Monad m => ConduitM (Int,Tox.CryptoMessage) XML.Event m () +pipe = toxToXmpp storeInvite localhost4 me (xmppHostname them) + +onlines = CL.replicate 50000 (1, Pkt USERSTATUS ==> Online) + +main = do + runConduit $ onlines .| pipe .| CL.mapM_ print + return () -- cgit v1.2.3