diff options
Diffstat (limited to 'dht')
-rw-r--r-- | dht/examples/dhtd.hs | 2 | ||||
-rw-r--r-- | dht/examples/tcpclient.hs | 2 | ||||
-rw-r--r-- | dht/src/DebugTag.hs | 1 | ||||
-rw-r--r-- | dht/src/Network/BitTorrent/MainlineDHT.hs | 5 | ||||
-rw-r--r-- | dht/src/Network/BitTorrent/Tracker/Transport.hs | 2 | ||||
-rw-r--r-- | dht/src/Network/Tox.hs | 21 | ||||
-rw-r--r-- | dht/src/Network/Tox/Onion/Routes.hs | 2 |
7 files changed, 16 insertions, 19 deletions
diff --git a/dht/examples/dhtd.hs b/dht/examples/dhtd.hs index de315e35..0dcb4237 100644 --- a/dht/examples/dhtd.hs +++ b/dht/examples/dhtd.hs | |||
@@ -1803,7 +1803,7 @@ main = do | |||
1803 | fromMaybe bail $ msock <&> \(udp,sock) -> do | 1803 | fromMaybe bail $ msock <&> \(udp,sock) -> do |
1804 | addr <- getSocketName sock | 1804 | addr <- getSocketName sock |
1805 | (bt,btR,btBootstrap4, btBootstrap6,quitBtClient) <- Mainline.newClient swarms addr udp | 1805 | (bt,btR,btBootstrap4, btBootstrap6,quitBtClient) <- Mainline.newClient swarms addr udp |
1806 | quitBt <- forkListener "bt" (clientNet bt) | 1806 | quitBt <- forkListener "bt" (dput XBitTorrent . mappend "bt-parse: ") (clientNet bt) |
1807 | mainlineSearches <- atomically $ newTVar Map.empty | 1807 | mainlineSearches <- atomically $ newTVar Map.empty |
1808 | peerPort <- atomically $ newTVar 6881 -- BitTorrent client TCP port. | 1808 | peerPort <- atomically $ newTVar 6881 -- BitTorrent client TCP port. |
1809 | let mainlineDHT bkts wantip = DHT | 1809 | let mainlineDHT bkts wantip = DHT |
diff --git a/dht/examples/tcpclient.hs b/dht/examples/tcpclient.hs index d168b1fb..858a617d 100644 --- a/dht/examples/tcpclient.hs +++ b/dht/examples/tcpclient.hs | |||
@@ -16,7 +16,7 @@ main = do | |||
16 | setVerbose XUnexpected | 16 | setVerbose XUnexpected |
17 | crypto <- newCrypto | 17 | crypto <- newCrypto |
18 | (_,client) <- newClient crypto id (\cb p -> cb (Just (False,p))) | 18 | (_,client) <- newClient crypto id (\cb p -> cb (Just (False,p))) |
19 | quitTCP <- forkListener "TCP-recv" (addHandler print (handleMessage client) $ clientNet client) | 19 | quitTCP <- forkListener "TCP-recv" (dput XTCP . (++) "tcp-parse: ") (addHandler print (handleMessage client) $ clientNet client) |
20 | args <- getArgs | 20 | args <- getArgs |
21 | let addr = read $ args !! 0 | 21 | let addr = read $ args !! 0 |
22 | 22 | ||
diff --git a/dht/src/DebugTag.hs b/dht/src/DebugTag.hs index 37593e63..b5f862dc 100644 --- a/dht/src/DebugTag.hs +++ b/dht/src/DebugTag.hs | |||
@@ -8,6 +8,7 @@ data DebugTag | |||
8 | | XAnnounceResponse | 8 | | XAnnounceResponse |
9 | | XBitTorrent | 9 | | XBitTorrent |
10 | | XDBus | 10 | | XDBus |
11 | | XDHT | ||
11 | | XLan | 12 | | XLan |
12 | | XMan | 13 | | XMan |
13 | | XNetCrypto | 14 | | XNetCrypto |
diff --git a/dht/src/Network/BitTorrent/MainlineDHT.hs b/dht/src/Network/BitTorrent/MainlineDHT.hs index a83cf740..705d7291 100644 --- a/dht/src/Network/BitTorrent/MainlineDHT.hs +++ b/dht/src/Network/BitTorrent/MainlineDHT.hs | |||
@@ -623,11 +623,8 @@ newClient swarms addr udp = do | |||
623 | gen :: Word16 -> (TransactionId, Word16) | 623 | gen :: Word16 -> (TransactionId, Word16) |
624 | gen cnt = (TransactionId $ S.encode cnt, cnt+1) | 624 | gen cnt = (TransactionId $ S.encode cnt, cnt+1) |
625 | 625 | ||
626 | ignoreParseError :: String -> IO () | ||
627 | ignoreParseError _ = return () | ||
628 | |||
629 | client = Client | 626 | client = Client |
630 | { clientNet = addHandler ignoreParseError (handleMessage client) net | 627 | { clientNet = addHandler (handleMessage client) net |
631 | , clientDispatcher = dispatch | 628 | , clientDispatcher = dispatch |
632 | , clientErrorReporter = ignoreErrors -- printErrors stderr | 629 | , clientErrorReporter = ignoreErrors -- printErrors stderr |
633 | , clientPending = map_var | 630 | , clientPending = map_var |
diff --git a/dht/src/Network/BitTorrent/Tracker/Transport.hs b/dht/src/Network/BitTorrent/Tracker/Transport.hs index 5d225a7e..eacf7946 100644 --- a/dht/src/Network/BitTorrent/Tracker/Transport.hs +++ b/dht/src/Network/BitTorrent/Tracker/Transport.hs | |||
@@ -94,4 +94,4 @@ implementTracker err net c = do | |||
94 | , clientAddress = const $ return localhost4 | 94 | , clientAddress = const $ return localhost4 |
95 | , clientResponseId = return | 95 | , clientResponseId = return |
96 | } | 96 | } |
97 | return $ addHandler (\err -> return ()) (handleMessage client) net | 97 | return $ addHandler (handleMessage client) net |
diff --git a/dht/src/Network/Tox.hs b/dht/src/Network/Tox.hs index 6adfb9a9..084a9978 100644 --- a/dht/src/Network/Tox.hs +++ b/dht/src/Network/Tox.hs | |||
@@ -174,7 +174,6 @@ newClient drg net classify selfAddr handlers modifytbl modifynet = do | |||
174 | , lookupHandler = handlers -- var | 174 | , lookupHandler = handlers -- var |
175 | , tableMethods = modifytbl tbl | 175 | , tableMethods = modifytbl tbl |
176 | } | 176 | } |
177 | eprinter = logErrors -- printErrors stderr | ||
178 | mkclient :: (TransactionMethods | 177 | mkclient :: (TransactionMethods |
179 | (g, pending) DHT.TransactionId addr x, | 178 | (g, pending) DHT.TransactionId addr x, |
180 | TVar (g, pending)) | 179 | TVar (g, pending)) |
@@ -184,9 +183,9 @@ newClient drg net classify selfAddr handlers modifytbl modifynet = do | |||
184 | -> ClientA String meth DHT.TransactionId addr x x | 183 | -> ClientA String meth DHT.TransactionId addr x x |
185 | mkclient (tbl,var) handlers = | 184 | mkclient (tbl,var) handlers = |
186 | let client = Client | 185 | let client = Client |
187 | { clientNet = addHandler (reportParseError eprinter) (handleMessage client) $ modifynet client net | 186 | { clientNet = addHandler (handleMessage client) $ modifynet client net |
188 | , clientDispatcher = dispatch tbl var (handlers client) client | 187 | , clientDispatcher = dispatch tbl var (handlers client) client |
189 | , clientErrorReporter = eprinter | 188 | , clientErrorReporter = logErrors |
190 | , clientPending = var | 189 | , clientPending = var |
191 | , clientAddress = selfAddr | 190 | , clientAddress = selfAddr |
192 | , clientResponseId = genNonce24 var | 191 | , clientResponseId = genNonce24 var |
@@ -412,8 +411,8 @@ newToxOverTransport keydb addr onNewSession (crypto,roster) udp tcp = do | |||
412 | { toxDHT = dhtclient | 411 | { toxDHT = dhtclient |
413 | , toxOnion = onionclient | 412 | , toxOnion = onionclient |
414 | , toxToRoute = onInbound (updateContactInfo roster) dtacrypt | 413 | , toxToRoute = onInbound (updateContactInfo roster) dtacrypt |
415 | , toxCrypto = addHandler (dput XMisc) (sessionHandler sessions) cryptonet | 414 | , toxCrypto = addHandler (sessionHandler sessions) cryptonet |
416 | , toxHandshakes = addHandler (dput XMisc) (handshakeH sparams) handshakes | 415 | , toxHandshakes = addHandler (handshakeH sparams) handshakes |
417 | , toxHandshakeCache = hscache | 416 | , toxHandshakeCache = hscache |
418 | , toxCryptoKeys = crypto | 417 | , toxCryptoKeys = crypto |
419 | , toxRouting = mkrouting dhtclient | 418 | , toxRouting = mkrouting dhtclient |
@@ -467,13 +466,13 @@ forkTox :: Tox extra | |||
467 | -> Bool -- tcp | 466 | -> Bool -- tcp |
468 | -> IO (IO (), [NodeInfo] -> [NodeInfo] -> IO (), [NodeInfo] -> [NodeInfo] -> IO ()) | 467 | -> IO (IO (), [NodeInfo] -> [NodeInfo] -> IO (), [NodeInfo] -> [NodeInfo] -> IO ()) |
469 | forkTox tox with_avahi with_tcp = do | 468 | forkTox tox with_avahi with_tcp = do |
470 | quitHs <- forkListener "toxHandshakes" (toxHandshakes tox) | 469 | quitHs <- forkListener "toxHandshakes" (dput XMan . mappend "hs-parse: ") (toxHandshakes tox) |
471 | quitToRoute <- forkListener "toxToRoute" (toxToRoute tox) | 470 | quitToRoute <- forkListener "toxToRoute" (dput XOnion . mappend "dta-parse: ") (toxToRoute tox) |
472 | quitOnion <- forkListener "toxOnion" (clientNet $ toxOnion tox) | 471 | quitOnion <- forkListener "toxOnion" (dput XOnion . mappend "onion-parse: ") (clientNet $ toxOnion tox) |
473 | quitDHT <- forkListener "toxDHT" (clientNet $ toxDHT tox) | 472 | quitDHT <- forkListener "toxDHT" (dput XDHT . mappend "dht-parse: ") (clientNet $ toxDHT tox) |
474 | quitNC <- forkListener "toxCrypto" (toxCrypto tox) | 473 | quitNC <- forkListener "toxCrypto" (dput XNetCrypto . mappend "nc-parse: ") (toxCrypto tox) |
475 | quitTCP <- if with_tcp | 474 | quitTCP <- if with_tcp |
476 | then forkListener "relay-client" (clientNet $ tcpClient $ tcpKademliaClient $ toxOnionRoutes tox) | 475 | then forkListener "relay-client" (dput XTCP . mappend "tcp-parse: ") (clientNet $ tcpClient $ tcpKademliaClient $ toxOnionRoutes tox) |
477 | else return $ return () | 476 | else return $ return () |
478 | refresher4 <- forkPollForRefresh (DHT.refresher4 $ toxRouting tox) | 477 | refresher4 <- forkPollForRefresh (DHT.refresher4 $ toxRouting tox) |
479 | refresher6 <- forkPollForRefresh (DHT.refresher6 $ toxRouting tox) | 478 | refresher6 <- forkPollForRefresh (DHT.refresher6 $ toxRouting tox) |
diff --git a/dht/src/Network/Tox/Onion/Routes.hs b/dht/src/Network/Tox/Onion/Routes.hs index 374b9648..46ded48d 100644 --- a/dht/src/Network/Tox/Onion/Routes.hs +++ b/dht/src/Network/Tox/Onion/Routes.hs | |||
@@ -249,7 +249,7 @@ newOnionRouter crypto perror tcp_enabled = do | |||
249 | , tcpKademliaClient = tcp | 249 | , tcpKademliaClient = tcp |
250 | { TCP.tcpClient = | 250 | { TCP.tcpClient = |
251 | let c = TCP.tcpClient tcp | 251 | let c = TCP.tcpClient tcp |
252 | in c { clientNet = addHandler perror (handleMessage c) | 252 | in c { clientNet = addHandler (handleMessage c) |
253 | $ onInbound (updateTCP or) | 253 | $ onInbound (updateTCP or) |
254 | $ clientNet c } | 254 | $ clientNet c } |
255 | } | 255 | } |