diff options
author | joe <joe@jerkface.net> | 2018-06-19 16:21:27 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2018-06-19 16:21:27 -0400 |
commit | c2df7b1192801862112a0f741014e27d490d12b3 (patch) | |
tree | d7e3dc460cfdaf15073ca2125268be88fa46570f /src/Network/Tox | |
parent | 0e799f254da5856d4ac929088df006f9497ac219 (diff) |
Reverting 0e799f254da which didn't improve performance.
Diffstat (limited to 'src/Network/Tox')
-rw-r--r-- | src/Network/Tox/Transport.hs | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/Network/Tox/Transport.hs b/src/Network/Tox/Transport.hs index 12ebb6d6..57f07aad 100644 --- a/src/Network/Tox/Transport.hs +++ b/src/Network/Tox/Transport.hs | |||
@@ -15,10 +15,6 @@ import Network.Tox.DHT.Transport | |||
15 | import Network.Tox.Onion.Transport | 15 | import Network.Tox.Onion.Transport |
16 | import Network.Tox.Crypto.Transport | 16 | import Network.Tox.Crypto.Transport |
17 | import OnionRouter | 17 | import OnionRouter |
18 | import Data.ByteString (ByteString) | ||
19 | import Control.Concurrent | ||
20 | import Control.Concurrent.STM | ||
21 | import Control.Concurrent.STM.TChan | ||
22 | 18 | ||
23 | import Network.Socket | 19 | import Network.Socket |
24 | 20 | ||
@@ -33,18 +29,8 @@ toxTransport :: | |||
33 | , Transport String AnnouncedRendezvous (PublicKey,OnionData) | 29 | , Transport String AnnouncedRendezvous (PublicKey,OnionData) |
34 | , Transport String SockAddr (Handshake Encrypted)) | 30 | , Transport String SockAddr (Handshake Encrypted)) |
35 | toxTransport crypto orouter closeLookup udp = do | 31 | toxTransport crypto orouter closeLookup udp = do |
36 | delayerChan <- newTChanIO | ||
37 | let delayerLoop = do | ||
38 | action <- atomically $ readTChan delayerChan | ||
39 | threadDelay 1000 | ||
40 | action | ||
41 | delayerLoop | ||
42 | let delayer = atomically . writeTChan delayerChan | ||
43 | delayer' = (fmap.fmap) delayer | ||
44 | forkIO delayerLoop | ||
45 | (netcrypto, udp0) <- partitionTransport parseCrypto encodeCrypto udp | 32 | (netcrypto, udp0) <- partitionTransport parseCrypto encodeCrypto udp |
46 | (dht,udp1) <- partitionTransportM (parseDHTAddr crypto) (fmap Just . encodeDHTAddr) $ forwardOnions crypto | 33 | (dht,udp1) <- partitionTransportM (parseDHTAddr crypto) (fmap Just . encodeDHTAddr) $ forwardOnions crypto udp0 |
47 | (modifySendMessage delayer' udp0) | ||
48 | (onion1,udp2) <- partitionTransportM (parseOnionAddr $ lookupSender orouter) | 34 | (onion1,udp2) <- partitionTransportM (parseOnionAddr $ lookupSender orouter) |
49 | (encodeOnionAddr crypto $ lookupRoute orouter) | 35 | (encodeOnionAddr crypto $ lookupRoute orouter) |
50 | udp1 | 36 | udp1 |
@@ -56,8 +42,6 @@ toxTransport crypto orouter closeLookup udp = do | |||
56 | , dta | 42 | , dta |
57 | , handshakes | 43 | , handshakes |
58 | ) | 44 | ) |
59 | where | ||
60 | modifySendMessage mod t@Transport{..} = Transport awaitMessage (mod sendMessage) closeTransport | ||
61 | 45 | ||
62 | 46 | ||
63 | -- instance (Sized a, Sized b) => Sized (a,b) where size = _todo | 47 | -- instance (Sized a, Sized b) => Sized (a,b) where size = _todo |