summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Network/QueryResponse.hs8
-rw-r--r--src/Network/Tox.hs13
2 files changed, 9 insertions, 12 deletions
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
565 return $ c { clientEnterQuery = \tid -> takeMVar mvar 565 return $ c { clientEnterQuery = \tid -> takeMVar mvar
566 , clientLeaveQuery = \tid didRespond -> putMVar mvar () 566 , clientLeaveQuery = \tid didRespond -> putMVar mvar ()
567 } 567 }
568
569retardSend micros client = do
570 mvar <- newMVar () :: IO (MVar ())
571 return client { clientEnterQuery = \tid -> do
572 takeMVar mvar
573 threadDelay micros
574 putMVar mvar ()
575 }
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
408 return $ Onion.OnionDestination Onion.SearchingAlias alias Nothing 408 return $ Onion.OnionDestination Onion.SearchingAlias alias Nothing
409 409
410 410
411retardSend micros client = do
412 mvar <- newMVar () :: IO (MVar ())
413 return client { clientEnterQuery = \tid -> do
414 takeMVar mvar
415 threadDelay micros
416 putMVar mvar ()
417 }
418
419newTox :: TVar Onion.AnnouncedKeys -- ^ Store of announced keys we are a rendezvous for. 411newTox :: TVar Onion.AnnouncedKeys -- ^ Store of announced keys we are a rendezvous for.
420 -> SockAddr -- ^ Bind-address to listen on. 412 -> SockAddr -- ^ Bind-address to listen on.
421 -> Maybe NetCryptoSessions -- ^ State of all one-on-one Tox links. 413 -> Maybe NetCryptoSessions -- ^ State of all one-on-one Tox links.
@@ -493,12 +485,9 @@ newTox keydb addr mbSessionsState suppliedDHTKey = do
493 (hookQueries orouter' DHT.transactionKey) 485 (hookQueries orouter' DHT.transactionKey)
494 (const id) 486 (const id)
495 487
496 -- onionclientSerialized <- serializeClient onionclient
497 onionRetarded <- retardSend 200000 onionclient
498
499 return Tox 488 return Tox
500 { toxDHT = dhtclient 489 { toxDHT = dhtclient
501 , toxOnion = onionRetarded 490 , toxOnion = onionclient
502 , toxToRoute = onInbound (updateContactInfo roster) dtacrypt 491 , toxToRoute = onInbound (updateContactInfo roster) dtacrypt
503 , toxCrypto = addHandler (hPutStrLn stderr) (sessionPacketH sessionsState) cryptonet 492 , toxCrypto = addHandler (hPutStrLn stderr) (sessionPacketH sessionsState) cryptonet
504 , toxHandshakes = addHandler (hPutStrLn stderr) (handshakeH sessionsState) handshakes 493 , toxHandshakes = addHandler (hPutStrLn stderr) (handshakeH sessionsState) handshakes