From bf9d8626bfa0758c3374c1e329f94a6b520a4b3b Mon Sep 17 00:00:00 2001 From: joe Date: Tue, 19 Jun 2018 23:39:50 -0400 Subject: Partial revert a564eb6, not sure about slower onion performance. --- src/Network/QueryResponse.hs | 8 ++++++++ src/Network/Tox.hs | 13 +------------ 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/Network/QueryResponse.hs b/src/Network/QueryResponse.hs index 70c35542..4e697109 100644 --- a/src/Network/QueryResponse.hs +++ b/src/Network/QueryResponse.hs @@ -565,3 +565,11 @@ serializeClient c = do return $ c { clientEnterQuery = \tid -> takeMVar mvar , clientLeaveQuery = \tid didRespond -> putMVar mvar () } + +retardSend micros client = do + mvar <- newMVar () :: IO (MVar ()) + return client { clientEnterQuery = \tid -> do + takeMVar mvar + threadDelay micros + putMVar mvar () + } diff --git a/src/Network/Tox.hs b/src/Network/Tox.hs index 4cff4f74..89a8d99f 100644 --- a/src/Network/Tox.hs +++ b/src/Network/Tox.hs @@ -408,14 +408,6 @@ getOnionAlias crypto dhtself remoteNode = atomically $ do return $ Onion.OnionDestination Onion.SearchingAlias alias Nothing -retardSend micros client = do - mvar <- newMVar () :: IO (MVar ()) - return client { clientEnterQuery = \tid -> do - takeMVar mvar - threadDelay micros - putMVar mvar () - } - newTox :: TVar Onion.AnnouncedKeys -- ^ Store of announced keys we are a rendezvous for. -> SockAddr -- ^ Bind-address to listen on. -> Maybe NetCryptoSessions -- ^ State of all one-on-one Tox links. @@ -493,12 +485,9 @@ newTox keydb addr mbSessionsState suppliedDHTKey = do (hookQueries orouter' DHT.transactionKey) (const id) - -- onionclientSerialized <- serializeClient onionclient - onionRetarded <- retardSend 200000 onionclient - return Tox { toxDHT = dhtclient - , toxOnion = onionRetarded + , toxOnion = onionclient , toxToRoute = onInbound (updateContactInfo roster) dtacrypt , toxCrypto = addHandler (hPutStrLn stderr) (sessionPacketH sessionsState) cryptonet , toxHandshakes = addHandler (hPutStrLn stderr) (handshakeH sessionsState) handshakes -- cgit v1.2.3