summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network')
-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