summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-06-30 20:32:13 -0400
committerjoe <joe@jerkface.net>2017-06-30 20:32:13 -0400
commitac8bced8dafa1a52bd02bdec8c1959af67442ed7 (patch)
tree53a158d5d598aecf3fb3d5dfba400ba32cd85a2b
parentb53ece2247e46d5eea9e433a54d0a833216fcc6d (diff)
Read instance for NodeId KMessageOf.
-rw-r--r--examples/dhtd.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs
index de1f11ab..68f91446 100644
--- a/examples/dhtd.hs
+++ b/examples/dhtd.hs
@@ -226,7 +226,8 @@ instance Kademlia Tox.Message where
226instance Pretty (NodeId Tox.Message) where 226instance Pretty (NodeId Tox.Message) where
227instance Pretty (NodeInfo Tox.Message IPv4 ()) where 227instance Pretty (NodeInfo Tox.Message IPv4 ()) where
228instance Pretty (NodeInfo Tox.Message IPv4 Bool) where -- TODO 228instance Pretty (NodeInfo Tox.Message IPv4 Bool) where -- TODO
229instance Read (NodeId KMessageOf) where -- TODO 229instance Read (NodeId KMessageOf) where
230 readsPrec d s = map (\(ih,s) -> (toNodeId (ih::InfoHash),s)) $ readsPrec d s
230instance Read (NodeId Tox.Message) where -- TODO 231instance Read (NodeId Tox.Message) where -- TODO
231instance Serialize (FindNode Tox.Message IPv4) where 232instance Serialize (FindNode Tox.Message IPv4) where
232 get = error "TODO get" 233 get = error "TODO get"
@@ -275,7 +276,7 @@ clientSession bt tox signalQuit isBt sock n h = do
275 cmd (GenericDHT action) = cmd0 $ join $ either (flip runDHT action) (flip runDHT action) dht 276 cmd (GenericDHT action) = cmd0 $ join $ either (flip runDHT action) (flip runDHT action) dht
276 cmd (BtDHT action) = cmd0 $ join $ runDHT bt action 277 cmd (BtDHT action) = cmd0 $ join $ runDHT bt action
277 (c,args) = second (dropWhile isSpace) $ break isSpace line 278 (c,args) = second (dropWhile isSpace) $ break isSpace line
278 switchNetwork dest = clientSession bt tox signalQuit dest sock n h 279 switchNetwork dest = hPutClient h ("Network: "++if dest then "mainline" else "tox") >> clientSession bt tox signalQuit dest sock n h
279 case (c,args) of 280 case (c,args) of
280 281
281 ("bt", _) -> switchNetwork True 282 ("bt", _) -> switchNetwork True