diff options
author | joe <joe@jerkface.net> | 2017-06-08 03:07:13 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-06-08 03:07:13 -0400 |
commit | 8c33deac14ca92ef67afc7fbcd3f67bc19317f88 (patch) | |
tree | e7636f38ae91ff0ef7c84091ccc65048cc45fea5 /examples | |
parent | d6fac9a8df0ce872ede54d6a71ca6d6c750eadc9 (diff) |
WIP: Adapting DHT to Tox network (part 6).
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dhtd.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs index c58b75e1..f81e7131 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs | |||
@@ -5,6 +5,7 @@ | |||
5 | {-# LANGUAGE ScopedTypeVariables #-} | 5 | {-# LANGUAGE ScopedTypeVariables #-} |
6 | {-# LANGUAGE TupleSections #-} | 6 | {-# LANGUAGE TupleSections #-} |
7 | {-# LANGUAGE RecordWildCards #-} | 7 | {-# LANGUAGE RecordWildCards #-} |
8 | {-# LANGUAGE PartialTypeSignatures #-} | ||
8 | {-# LANGUAGE CPP #-} | 9 | {-# LANGUAGE CPP #-} |
9 | 10 | ||
10 | import Control.Arrow | 11 | import Control.Arrow |
@@ -118,7 +119,7 @@ resume = do | |||
118 | restore_attempt | 119 | restore_attempt |
119 | return saved_nodes | 120 | return saved_nodes |
120 | 121 | ||
121 | godht :: String -> (NodeAddr IPv4 -> NodeId -> DHT IPv4 b) -> IO b | 122 | godht :: String -> (NodeAddr IPv4 -> NodeId _ -> DHT IPv4 b) -> IO b |
122 | godht p f = do | 123 | godht p f = do |
123 | a <- btBindAddr p False | 124 | a <- btBindAddr p False |
124 | dht def { optTimeout = 5 } a noDebugPrints $ do | 125 | dht def { optTimeout = 5 } a noDebugPrints $ do |
@@ -314,10 +315,10 @@ consip' (ReflectedIP ip) xs = ("to", show ip) : xs | |||
314 | 315 | ||
315 | reportPong (info,myip) = maybe id consip myip [show $ pPrint info] | 316 | reportPong (info,myip) = maybe id consip myip [show $ pPrint info] |
316 | 317 | ||
317 | reportNodes :: (NodeId, NodeFound IPv4, Maybe ReflectedIP) -> [String] | 318 | reportNodes :: (NodeId _, NodeFound IPv4, Maybe ReflectedIP) -> [String] |
318 | reportNodes (nid,NodeFound ns,myip) = maybe id consip myip $ show (pPrint nid) : map (show . pPrint) ns | 319 | reportNodes (nid,NodeFound ns,myip) = maybe id consip myip $ show (pPrint nid) : map (show . pPrint) ns |
319 | 320 | ||
320 | reportPeers :: (NodeId, GotPeers IPv4, Maybe ReflectedIP) -> [(String,String)] | 321 | reportPeers :: (NodeId _, GotPeers IPv4, Maybe ReflectedIP) -> [(String,String)] |
321 | reportPeers (nid,GotPeers r tok,myip) | 322 | reportPeers (nid,GotPeers r tok,myip) |
322 | = maybe id consip' myip $ ("from", show (pPrint nid)) | 323 | = maybe id consip' myip $ ("from", show (pPrint nid)) |
323 | : ("token", show tok) | 324 | : ("token", show tok) |