summaryrefslogtreecommitdiff
path: root/src/Network/Tox
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-06-19 16:21:27 -0400
committerjoe <joe@jerkface.net>2018-06-19 16:21:27 -0400
commitc2df7b1192801862112a0f741014e27d490d12b3 (patch)
treed7e3dc460cfdaf15073ca2125268be88fa46570f /src/Network/Tox
parent0e799f254da5856d4ac929088df006f9497ac219 (diff)
Reverting 0e799f254da which didn't improve performance.
Diffstat (limited to 'src/Network/Tox')
-rw-r--r--src/Network/Tox/Transport.hs18
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
15import Network.Tox.Onion.Transport 15import Network.Tox.Onion.Transport
16import Network.Tox.Crypto.Transport 16import Network.Tox.Crypto.Transport
17import OnionRouter 17import OnionRouter
18import Data.ByteString (ByteString)
19import Control.Concurrent
20import Control.Concurrent.STM
21import Control.Concurrent.STM.TChan
22 18
23import Network.Socket 19import 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))
35toxTransport crypto orouter closeLookup udp = do 31toxTransport 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