summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-12-02 14:38:07 -0500
committerJoe Crayne <joe@jerkface.net>2020-01-01 23:22:52 -0500
commit80296b10d4387200fa022e2ad5c87d23fdd11a00 (patch)
treeee594698ab0d3c63a8575cf02c8ad3befa51ef9e
parentbb190ea0bb2671214aad75f43f06a7c41c94f2bd (diff)
Switch to disable TCP.
-rw-r--r--dht/OnionRouter.hs30
-rw-r--r--dht/examples/dhtd.hs26
-rw-r--r--dht/examples/testTox.hs8
-rw-r--r--dht/src/Network/Tox.hs38
4 files changed, 68 insertions, 34 deletions
diff --git a/dht/OnionRouter.hs b/dht/OnionRouter.hs
index bdaf04b2..e6f647b5 100644
--- a/dht/OnionRouter.hs
+++ b/dht/OnionRouter.hs
@@ -70,7 +70,7 @@ data OnionRouter = OnionRouter
70 -- | A set for TCP relays to use as trampolines when UDP is not available. 70 -- | A set for TCP relays to use as trampolines when UDP is not available.
71 , trampolinesTCP :: TrampolineSet TCP.NodeInfo 71 , trampolinesTCP :: TrampolineSet TCP.NodeInfo
72 -- | True when we need to rely on TCP relays because UDP is apparently unavailable. 72 -- | True when we need to rely on TCP relays because UDP is apparently unavailable.
73 , tcpMode :: TVar Bool 73 , tcpMode :: TVar (Maybe Bool) -- Nothing: tcp disabled, False: use trampolinesUDP, True: use trampolinesTCP
74 -- | The pseudo-random generator used to select onion routes. 74 -- | The pseudo-random generator used to select onion routes.
75 , onionDRG :: TVar ChaChaDRG 75 , onionDRG :: TVar ChaChaDRG
76 -- | Building onion routes happens in a dedicated thread. See 'forkRouteBuilder'. 76 -- | Building onion routes happens in a dedicated thread. See 'forkRouteBuilder'.
@@ -154,11 +154,12 @@ newtype RouteEvent = BuildRoute RouteId
154 154
155newOnionRouter :: TransportCrypto 155newOnionRouter :: TransportCrypto
156 -> (String -> IO ()) 156 -> (String -> IO ())
157 -> Bool -- is tcp enabled?
157 -> IO ( OnionRouter 158 -> IO ( OnionRouter
158 , TVar ( ChaChaDRG 159 , TVar ( ChaChaDRG
159 , Word64Map (Either (Maybe (Bool,TCP.RelayPacket) -> IO ()) 160 , Word64Map (Either (Maybe (Bool,TCP.RelayPacket) -> IO ())
160 (Maybe (OnionMessage Identity) -> IO ())))) 161 (Maybe (OnionMessage Identity) -> IO ()))))
161newOnionRouter crypto perror = do 162newOnionRouter crypto perror tcp_enabled = do
162 drg0 <- drgNew 163 drg0 <- drgNew
163 (rlog,pq,rm) <- atomically $ do 164 (rlog,pq,rm) <- atomically $ do
164 rlog <- newTChan 165 rlog <- newTChan
@@ -222,7 +223,7 @@ newOnionRouter crypto perror = do
222 tbl 223 tbl
223 (TCP.nodeSearch prober tcp) 224 (TCP.nodeSearch prober tcp)
224 (fmap (maybe False $ const True) . TCP.tcpPing (TCP.tcpClient tcp)) 225 (fmap (maybe False $ const True) . TCP.tcpPing (TCP.tcpClient tcp))
225 tcpmode <- newTVar True 226 tcpmode <- newTVar $ if tcp_enabled then Just True else Nothing
226 let o = OnionRouter 227 let o = OnionRouter
227 { pendingRoutes = pr 228 { pendingRoutes = pr
228 , onionDRG = drg 229 , onionDRG = drg
@@ -369,9 +370,12 @@ selectTrampolines or = do
369 let tset :: (forall x. TrampolineSet x -> STM (Either [x] [x])) 370 let tset :: (forall x. TrampolineSet x -> STM (Either [x] [x]))
370 -> STM (Either (Either [TCP.NodeInfo] [NodeInfo]) 371 -> STM (Either (Either [TCP.NodeInfo] [NodeInfo])
371 (Either [TCP.NodeInfo] [NodeInfo])) 372 (Either [TCP.NodeInfo] [NodeInfo]))
372 tset f = bool (left Right . right Right <$> f (trampolinesUDP or)) 373 tset f = do
373 (left Left . right Left <$> f (trampolinesTCP or)) 374 mm <- readTVar (tcpMode or)
374 =<< readTVar (tcpMode or) 375 -- TODO: better logic for deciding to use TCP or UDP trampolines.
376 if fromMaybe False mm
377 then left Left . right Left <$> f (trampolinesTCP or)
378 else left Right . right Right <$> f (trampolinesUDP or)
375 atomically (tset $ internalSelectTrampolines (onionDRG or)) >>= \case 379 atomically (tset $ internalSelectTrampolines (onionDRG or)) >>= \case
376 Left ns -> do 380 Left ns -> do
377 -- atomically $ writeTChan (routeLog or) 381 -- atomically $ writeTChan (routeLog or)
@@ -710,3 +714,17 @@ ipClass' :: SockAddr -> IPClass
710ipClass' (SockAddrInet _ addr) = IPClass (fromBE32 addr .&. 0xFF000000) 714ipClass' (SockAddrInet _ addr) = IPClass (fromBE32 addr .&. 0xFF000000)
711ipClass' (SockAddrInet6 _ _ (hiword,_,_,_) _) = IPClass hiword 715ipClass' (SockAddrInet6 _ _ (hiword,_,_,_) _) = IPClass hiword
712ipClass' _ = IPClass 0 -- unreachable. 716ipClass' _ = IPClass 0 -- unreachable.
717
718requestTCPMode :: OnionRouter -> Maybe Bool -> IO Bool
719requestTCPMode or wanted_mode = atomically $ requestTCPModeSTM or wanted_mode
720
721requestTCPModeSTM :: OnionRouter -> Maybe Bool -> STM Bool
722requestTCPModeSTM or wanted_mode = do
723 m <- readTVar (tcpMode or)
724 case m of
725 Nothing -> return False
726 Just oldmode -> case wanted_mode of
727 Just newmode -> do
728 writeTVar (tcpMode or) (Just newmode)
729 return newmode
730 Nothing -> return oldmode
diff --git a/dht/examples/dhtd.hs b/dht/examples/dhtd.hs
index adfe0d69..9c03a4f9 100644
--- a/dht/examples/dhtd.hs
+++ b/dht/examples/dhtd.hs
@@ -706,7 +706,7 @@ clientSession s@Session{..} sock cnum h = do
706 tcp_spill <- readTVar (TCP.probeSpill $ tcpProber onionRouter) 706 tcp_spill <- readTVar (TCP.probeSpill $ tcpProber onionRouter)
707 tcp_cache <- readTVar (TCP.probeCache $ tcpProber onionRouter) 707 tcp_cache <- readTVar (TCP.probeCache $ tcpProber onionRouter)
708 tcp_queue <- readTVar (TCP.probeQueue $ tcpProber onionRouter) 708 tcp_queue <- readTVar (TCP.probeQueue $ tcpProber onionRouter)
709 tcpmode <- readTVar (tcpMode onionRouter) 709 tcpmode <- requestTCPModeSTM onionRouter Nothing
710 tcps <- readTVar (TCP.lru $ tcpProberState onionRouter) 710 tcps <- readTVar (TCP.lru $ tcpProberState onionRouter)
711 let showRecord :: Int -> Int -> [String] 711 let showRecord :: Int -> Int -> [String]
712 showRecord n wanted_ver 712 showRecord n wanted_ver
@@ -734,13 +734,13 @@ clientSession s@Session{..} sock cnum h = do
734 734
735 ("onion", s) | "udp" <- strp $ map toLower s 735 ("onion", s) | "udp" <- strp $ map toLower s
736 -> cmd0 $ do 736 -> cmd0 $ do
737 atomically $ writeTVar (tcpMode onionRouter) False 737 tcpm <- requestTCPMode onionRouter (Just False)
738 hPutClient h "Onion routes: UDP." 738 hPutClient h $ "Onion routes: " ++ if tcpm then "TCP." else "UDP."
739 739
740 ("onion", s) | "tcp" <- strp $ map toLower s 740 ("onion", s) | "tcp" <- strp $ map toLower s
741 -> cmd0 $ do 741 -> cmd0 $ do
742 atomically $ writeTVar (tcpMode onionRouter) True 742 tcpm <- requestTCPMode onionRouter (Just True)
743 hPutClient h "Onion routes: TCP." 743 hPutClient h $ "Onion routes: " ++ if tcpm then "TCP." else "UDP."
744 744
745 ("g", s) | Just DHT{..} <- Map.lookup netname dhts 745 ("g", s) | Just DHT{..} <- Map.lookup netname dhts
746 -> cmd0 $ do 746 -> cmd0 $ do
@@ -1119,6 +1119,7 @@ data Options = Options
1119 , verbosity :: Int 1119 , verbosity :: Int
1120 , verboseTags :: [DebugTag] 1120 , verboseTags :: [DebugTag]
1121 , advertiseOnAvahi :: Bool 1121 , advertiseOnAvahi :: Bool
1122 , enableTCPDHT :: Bool
1122 } 1123 }
1123 deriving (Eq,Show) 1124 deriving (Eq,Show)
1124 1125
@@ -1134,6 +1135,7 @@ sensibleDefaults = Options
1134 , verbosity = 2 1135 , verbosity = 2
1135 , verboseTags = [XUnexpected, XUnused] 1136 , verboseTags = [XUnexpected, XUnused]
1136 , advertiseOnAvahi = True 1137 , advertiseOnAvahi = True
1138 , enableTCPDHT = True
1137 } 1139 }
1138 1140
1139data ShowHelp = ShowHelp 1141data ShowHelp = ShowHelp
@@ -1145,6 +1147,7 @@ usage ShowHelp
1145 ,["--dht-key ",dhtkey]],["Use ",dhtkey," as the dht key"]) 1147 ,["--dht-key ",dhtkey]],["Use ",dhtkey," as the dht key"])
1146 , ([["-4"]] ,["Use IPv4 only"]) 1148 , ([["-4"]] ,["Use IPv4 only"])
1147 , ([["--noavahi"]] ,["Disable avahi advertising on LAN"]) 1149 , ([["--noavahi"]] ,["Disable avahi advertising on LAN"])
1150 , ([["--notcp"]] ,["Disable TCP-relay server and client-based DHT"])
1148 , ([["-v ",tags]] ,["Enable or disable specified DebugTags.\n DebugTags = ", listDebugTags]) 1151 , ([["-v ",tags]] ,["Enable or disable specified DebugTags.\n DebugTags = ", listDebugTags])
1149 ] ; 1152 ] ;
1150 dhtkey ="<dhtkey>" ; 1153 dhtkey ="<dhtkey>" ;
@@ -1165,6 +1168,7 @@ parseArgs :: [String] -> Options -> Either ShowHelp Options
1165parseArgs [] opts = Right opts 1168parseArgs [] opts = Right opts
1166parseArgs ("--help":args) opts = Left ShowHelp 1169parseArgs ("--help":args) opts = Left ShowHelp
1167parseArgs ("--noavahi":args) opts = parseArgs args opts { advertiseOnAvahi = False } 1170parseArgs ("--noavahi":args) opts = parseArgs args opts { advertiseOnAvahi = False }
1171parseArgs ("--notcp":args) opts = parseArgs args opts { enableTCPDHT = False }
1168parseArgs ("--dhtkey":k:args) opts = parseArgs args opts 1172parseArgs ("--dhtkey":k:args) opts = parseArgs args opts
1169 { dhtkey = decodeSecret $ B.pack k } 1173 { dhtkey = decodeSecret $ B.pack k }
1170parseArgs ("--dht-key":k:args) opts = parseArgs args opts 1174parseArgs ("--dht-key":k:args) opts = parseArgs args opts
@@ -1384,9 +1388,9 @@ initTox opts ssvar keysdb mbxmpp invc = case porttox opts of
1384 Nothing -> \_ _ _ -> return () 1388 Nothing -> \_ _ _ -> return ()
1385 Just xmpp -> onNewToxSession xmpp ssvar invc) 1389 Just xmpp -> onNewToxSession xmpp ssvar invc)
1386 crypto 1390 crypto
1387 (\_ _ -> return ()) -- TODO: TCP relay send 1391 (enableTCPDHT opts)
1388 -- addrTox <- getBindAddress toxport (ip6tox opts) 1392 -- addrTox <- getBindAddress toxport (ip6tox opts)
1389 (quitTox, toxStrap4, toxStrap6) <- Tox.forkTox tox (advertiseOnAvahi opts) 1393 (quitTox, toxStrap4, toxStrap6) <- Tox.forkTox tox (advertiseOnAvahi opts) (enableTCPDHT opts)
1390 1394
1391 toxSearches <- atomically $ newTVar Map.empty 1395 toxSearches <- atomically $ newTVar Map.empty
1392 1396
@@ -1592,9 +1596,11 @@ initTox opts ssvar keysdb mbxmpp invc = case porttox opts of
1592 dhts = Map.fromList $ 1596 dhts = Map.fromList $
1593 ("tox4", toxDHT Tox.routing4 Want_IP4) 1597 ("tox4", toxDHT Tox.routing4 Want_IP4)
1594 : (if ip6tox opts 1598 : (if ip6tox opts
1595 then [ ("tox6", toxDHT Tox.routing6 Want_IP6) ] 1599 then ( ("tox6", toxDHT Tox.routing6 Want_IP6) :)
1600 else id)
1601 (if enableTCPDHT opts
1602 then [ ("toxtcp", tcpDHT) ]
1596 else []) 1603 else [])
1597 ++ [("toxtcp", tcpDHT)]
1598 ips :: IO [SockAddr] 1604 ips :: IO [SockAddr]
1599 ips = readExternals Tox.nodeAddr [ Tox.routing4 $ Tox.toxRouting tox 1605 ips = readExternals Tox.nodeAddr [ Tox.routing4 $ Tox.toxRouting tox
1600 , Tox.routing6 $ Tox.toxRouting tox ] 1606 , Tox.routing6 $ Tox.toxRouting tox ]
@@ -1777,7 +1783,7 @@ main = do
1777 let defaultToxData = do 1783 let defaultToxData = do
1778 rster <- Tox.newContactInfo 1784 rster <- Tox.newContactInfo
1779 crypto <- newCrypto 1785 crypto <- newCrypto
1780 (orouter,_) <- newOnionRouter crypto (dput XMisc) 1786 (orouter,_) <- newOnionRouter crypto (dput XMisc) (enableTCPDHT opts)
1781 return (rster, orouter) 1787 return (rster, orouter)
1782 (rstr,orouter) <- fromMaybe defaultToxData $ do 1788 (rstr,orouter) <- fromMaybe defaultToxData $ do
1783 tox <- mbtox 1789 tox <- mbtox
diff --git a/dht/examples/testTox.hs b/dht/examples/testTox.hs
index 57601422..6db977be 100644
--- a/dht/examples/testTox.hs
+++ b/dht/examples/testTox.hs
@@ -48,7 +48,7 @@ makeToxNode udp sec onSessionF = do
48 onSessionF 48 onSessionF
49 crypto 49 crypto
50 udp 50 udp
51 (\_ _ -> return ()) 51 Nothing
52 52
53 53
54setToxID :: Tox () -> Maybe SecretKey -> IO () 54setToxID :: Tox () -> Maybe SecretKey -> IO ()
@@ -113,8 +113,8 @@ main = do
113 113
114 -- b_sessions <- sessionChan b_OM7znaPMYkTbm'9GcZJAdnDATXmZxZ9fnaSTP3qNCZk 114 -- b_sessions <- sessionChan b_OM7znaPMYkTbm'9GcZJAdnDATXmZxZ9fnaSTP3qNCZk
115 115
116 (a_quit,_,_) <- forkTox a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf False 116 (a_quit,_,_) <- forkTox a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf False False
117 (b_quit,_,_) <- forkTox b_OM7znaPMYkTbm'9GcZJAdnDATXmZxZ9fnaSTP3qNCZk False 117 (b_quit,_,_) <- forkTox b_OM7znaPMYkTbm'9GcZJAdnDATXmZxZ9fnaSTP3qNCZk False False
118 118
119 threadReport False >>= putStrLn 119 threadReport False >>= putStrLn
120 120
@@ -149,7 +149,7 @@ main = do
149 149
150 -- sendMessage (toxHandshakes a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf) (nodeAddr b) hs 150 -- sendMessage (toxHandshakes a_Ct7g5azVcJ8KnvxzbXs9GqeqcjrP7VdZXIC'uHeTlRf) (nodeAddr b) hs
151 151
152 (b_quit,_,_) <- forkTox b_OM7znaPMYkTbm'9GcZJAdnDATXmZxZ9fnaSTP3qNCZk False 152 (b_quit,_,_) <- forkTox b_OM7znaPMYkTbm'9GcZJAdnDATXmZxZ9fnaSTP3qNCZk False False
153 153
154 forkIO $ do 154 forkIO $ do
155 tid <- myThreadId 155 tid <- myThreadId
diff --git a/dht/src/Network/Tox.hs b/dht/src/Network/Tox.hs
index 34e63ad8..746d8667 100644
--- a/dht/src/Network/Tox.hs
+++ b/dht/src/Network/Tox.hs
@@ -23,6 +23,7 @@ import Control.Concurrent.Lifted.Instrument
23#else 23#else
24import Control.Concurrent.Lifted 24import Control.Concurrent.Lifted
25#endif 25#endif
26import Control.Arrow
26import Control.Concurrent.STM 27import Control.Concurrent.STM
27import Control.Exception (throwIO) 28import Control.Exception (throwIO)
28import Control.Monad 29import Control.Monad
@@ -281,9 +282,10 @@ newTox :: TVar Onion.AnnouncedKeys -- ^ Store of announced keys we are a rende
281 -> [String] -- ^ Bind-address to listen on. Must provide at least one. 282 -> [String] -- ^ Bind-address to listen on. Must provide at least one.
282 -> ( ContactInfo extra -> SockAddr -> Session -> IO () ) 283 -> ( ContactInfo extra -> SockAddr -> Session -> IO () )
283 -> (TransportCrypto, ContactInfo extra) 284 -> (TransportCrypto, ContactInfo extra)
284 -> ( Int -> Onion.OnionMessage Encrypted -> IO () ) -- ^ TCP-bound onion responses. 285 -> Bool -- Enable TCP messages.
286 -- ( Int -> Onion.OnionMessage Encrypted -> IO () ) -- ^ TCP-bound onion responses. XXX ignored
285 -> IO (Tox extra) 287 -> IO (Tox extra)
286newTox keydb bindspecs onsess crypto tcp = do 288newTox keydb bindspecs onsess crypto usetcp = do
287 addrs <- mapM (`getBindAddress` True) bindspecs 289 addrs <- mapM (`getBindAddress` True) bindspecs
288 let tryBind addr next _ = udpTransport' addr `catchIOError` (next . Just) 290 let tryBind addr next _ = udpTransport' addr `catchIOError` (next . Just)
289 failedBind mbe = do 291 failedBind mbe = do
@@ -294,14 +296,17 @@ newTox keydb bindspecs onsess crypto tcp = do
294 (udp,sock) <- foldr tryBind failedBind addrs Nothing 296 (udp,sock) <- foldr tryBind failedBind addrs Nothing
295 addr <- getSocketName sock 297 addr <- getSocketName sock
296 dput XOnion $ "UDP bind address: " ++ show addr 298 dput XOnion $ "UDP bind address: " ++ show addr
297 (relay,sendTCP) <- tcpRelay (fst crypto) addr $ \a x -> do 299 (relay,sendTCP) <-
298 let bs = S.runPut $ Onion.putRequest x 300 if usetcp then do
299 dput XOnion $ "Sending onion(0x" ++ (C8.unpack . Base16.encode) (B.take 1 bs) ++ ") from tcp-client to " ++ show a 301 fmap (Just *** Just) $ tcpRelay (fst crypto) addr $ \a x -> do
300 -- mapM_ (dput XOnion) (xxd2 0 bs) 302 let bs = S.runPut $ Onion.putRequest x
301 sendMessage udp (substituteLoopback addr a) bs 303 dput XOnion $ "Sending onion(0x" ++ (C8.unpack . Base16.encode) (B.take 1 bs) ++ ") from tcp-client to " ++ show a
304 -- mapM_ (dput XOnion) (xxd2 0 bs)
305 sendMessage udp (substituteLoopback addr a) bs
306 else return (Nothing, Nothing)
302 tox <- newToxOverTransport keydb addr onsess crypto udp sendTCP 307 tox <- newToxOverTransport keydb addr onsess crypto udp sendTCP
303 return tox { toxAnnounceToLan = announceToLan sock (key2id $ transportPublic $ toxCryptoKeys tox) 308 return tox { toxAnnounceToLan = announceToLan sock (key2id $ transportPublic $ toxCryptoKeys tox)
304 , toxRelayServer = Just relay 309 , toxRelayServer = relay
305 } 310 }
306 311
307newToxCrypto :: Maybe SecretKey -> IO (TransportCrypto, ContactInfo extra) 312newToxCrypto :: Maybe SecretKey -> IO (TransportCrypto, ContactInfo extra)
@@ -328,18 +333,18 @@ newToxOverTransport :: TVar Onion.AnnouncedKeys
328 -> ( ContactInfo extra -> SockAddr -> Session -> IO () ) 333 -> ( ContactInfo extra -> SockAddr -> Session -> IO () )
329 -> (TransportCrypto, ContactInfo extra) 334 -> (TransportCrypto, ContactInfo extra)
330 -> Onion.UDPTransport 335 -> Onion.UDPTransport
331 -> ( Int -> Onion.OnionMessage Encrypted -> IO () ) -- ^ TCP-bound onion responses. 336 -> Maybe ( Int -> Onion.OnionMessage Encrypted -> IO () ) -- ^ TCP-bound onion responses.
332 -> IO (Tox extra) 337 -> IO (Tox extra)
333newToxOverTransport keydb addr onNewSession (crypto,roster) udp tcp = do 338newToxOverTransport keydb addr onNewSession (crypto,roster) udp tcp = do
334 drg <- drgNew 339 drg <- drgNew
335 let lookupClose _ = return Nothing 340 let lookupClose _ = return Nothing
336 341
337 mkrouting <- DHT.newRouting addr crypto updateIP updateIP 342 mkrouting <- DHT.newRouting addr crypto updateIP updateIP
338 (orouter,otbl) <- newOnionRouter crypto (dput XRoutes) 343 (orouter,otbl) <- newOnionRouter crypto (dput XRoutes) (maybe False (const True) tcp)
339 (cryptonet,dhtcrypt,onioncrypt,dtacrypt,handshakes) 344 (cryptonet,dhtcrypt,onioncrypt,dtacrypt,handshakes)
340 <- toxTransport crypto orouter lookupClose addr udp 345 <- toxTransport crypto orouter lookupClose addr udp
341 (\dst x -> sendMessage (clientNet $ tcpClient $ tcpKademliaClient orouter) dst (True,x)) 346 (\dst x -> sendMessage (clientNet $ tcpClient $ tcpKademliaClient orouter) dst (True,x))
342 tcp 347 (fromMaybe (\_ _ -> return ()) tcp)
343 sessions <- initSessions (sendMessage cryptonet) 348 sessions <- initSessions (sendMessage cryptonet)
344 349
345 let dhtnet0 = layerTransportM (DHT.decrypt crypto) (DHT.encrypt crypto) dhtcrypt 350 let dhtnet0 = layerTransportM (DHT.decrypt crypto) (DHT.encrypt crypto) dhtcrypt
@@ -420,14 +425,19 @@ dnssdDiscover tox ni toxid = do
420-- * action to bootstrap an IPv4 Kademlia table. 425-- * action to bootstrap an IPv4 Kademlia table.
421-- 426--
422-- * action to bootstrap an IPv6 Kademlia table. 427-- * action to bootstrap an IPv6 Kademlia table.
423forkTox :: Tox extra -> Bool -> IO (IO (), [NodeInfo] -> [NodeInfo] -> IO (), [NodeInfo] -> [NodeInfo] -> IO ()) 428forkTox :: Tox extra
424forkTox tox with_avahi = do 429 -> Bool -- avahi
430 -> Bool -- tcp
431 -> IO (IO (), [NodeInfo] -> [NodeInfo] -> IO (), [NodeInfo] -> [NodeInfo] -> IO ())
432forkTox tox with_avahi with_tcp = do
425 quitHs <- forkListener "toxHandshakes" (toxHandshakes tox) 433 quitHs <- forkListener "toxHandshakes" (toxHandshakes tox)
426 quitToRoute <- forkListener "toxToRoute" (toxToRoute tox) 434 quitToRoute <- forkListener "toxToRoute" (toxToRoute tox)
427 quitOnion <- forkListener "toxOnion" (clientNet $ toxOnion tox) 435 quitOnion <- forkListener "toxOnion" (clientNet $ toxOnion tox)
428 quitDHT <- forkListener "toxDHT" (clientNet $ toxDHT tox) 436 quitDHT <- forkListener "toxDHT" (clientNet $ toxDHT tox)
429 quitNC <- forkListener "toxCrypto" (toxCrypto tox) 437 quitNC <- forkListener "toxCrypto" (toxCrypto tox)
430 quitTCP <- forkListener "relay-client" (clientNet $ tcpClient $ tcpKademliaClient $ toxOnionRoutes tox) 438 quitTCP <- if with_tcp
439 then forkListener "relay-client" (clientNet $ tcpClient $ tcpKademliaClient $ toxOnionRoutes tox)
440 else return $ return ()
431 refresher4 <- forkPollForRefresh (DHT.refresher4 $ toxRouting tox) 441 refresher4 <- forkPollForRefresh (DHT.refresher4 $ toxRouting tox)
432 refresher6 <- forkPollForRefresh (DHT.refresher6 $ toxRouting tox) 442 refresher6 <- forkPollForRefresh (DHT.refresher6 $ toxRouting tox)
433 quitAvahi <- if with_avahi then do 443 quitAvahi <- if with_avahi then do