summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-06-22 02:35:29 -0400
committerjoe <joe@jerkface.net>2017-06-22 02:35:29 -0400
commit05e70386c2248d87a61a8e8267e0211597f2fa88 (patch)
tree5ac4d86c8d69c6dddd9840f8cb6efda9288e1a38 /src
parente0ada56c116255a2feddcf7b09cec808f79afefc (diff)
Simplified KRPC class.
Diffstat (limited to 'src')
-rw-r--r--src/Network/DHT/Mainline.hs12
-rw-r--r--src/Network/KRPC/Method.hs5
2 files changed, 0 insertions, 17 deletions
diff --git a/src/Network/DHT/Mainline.hs b/src/Network/DHT/Mainline.hs
index a5f4f606..d118ceb0 100644
--- a/src/Network/DHT/Mainline.hs
+++ b/src/Network/DHT/Mainline.hs
@@ -227,9 +227,6 @@ instance Serialize (Response Ping) where
227-- | \"q\" = \"ping\" 227-- | \"q\" = \"ping\"
228instance KRPC (Query Ping) (Response Ping) where 228instance KRPC (Query Ping) (Response Ping) where
229#ifdef VERSION_bencoding 229#ifdef VERSION_bencoding
230 type Envelope (Query Ping) (Response Ping) = BValue
231 seal = toBEncode
232 unseal = fromBEncode
233 method = "ping" 230 method = "ping"
234#else 231#else
235 method = Method Tox.Ping -- response: Tox.Pong 232 method = Method Tox.Ping -- response: Tox.Pong
@@ -319,9 +316,6 @@ instance Serialize (Response (NodeFound ip)) where
319instance (Address ip, Typeable ip) 316instance (Address ip, Typeable ip)
320 => KRPC (Query (FindNode ip)) (Response (NodeFound ip)) where 317 => KRPC (Query (FindNode ip)) (Response (NodeFound ip)) where
321#ifdef VERSION_bencoding 318#ifdef VERSION_bencoding
322 type Envelope (Query (FindNode ip)) (Response (NodeFound ip)) = BValue
323 seal = toBEncode
324 unseal = fromBEncode
325 method = "find_node" 319 method = "find_node"
326#else 320#else
327 method = Method Tox.GetNodes -- response: Tox.SendNodes 321 method = Method Tox.GetNodes -- response: Tox.SendNodes
@@ -390,9 +384,6 @@ instance (Typeable ip, Serialize ip) => BEncode (GotPeers ip) where
390-- | \"q" = \"get_peers\" 384-- | \"q" = \"get_peers\"
391instance (Typeable ip, Serialize ip) => 385instance (Typeable ip, Serialize ip) =>
392 KRPC (Query (GetPeers ip)) (Response (GotPeers ip)) where 386 KRPC (Query (GetPeers ip)) (Response (GotPeers ip)) where
393 type Envelope (Query (GetPeers ip)) (Response (GotPeers ip)) = BValue
394 seal = toBEncode
395 unseal = fromBEncode
396 method = "get_peers" 387 method = "get_peers"
397 388
398{----------------------------------------------------------------------- 389{-----------------------------------------------------------------------
@@ -465,9 +456,6 @@ instance BEncode Announced where
465 456
466-- | \"q" = \"announce\" 457-- | \"q" = \"announce\"
467instance KRPC (Query Announce) (Response Announced) where 458instance KRPC (Query Announce) (Response Announced) where
468 type Envelope (Query Announce) (Response Announced) = BValue
469 seal = toBEncode
470 unseal = fromBEncode
471 method = "announce_peer" 459 method = "announce_peer"
472 460
473-- endif VERSION_bencoding 461-- endif VERSION_bencoding
diff --git a/src/Network/KRPC/Method.hs b/src/Network/KRPC/Method.hs
index ea11720c..3a2bd020 100644
--- a/src/Network/KRPC/Method.hs
+++ b/src/Network/KRPC/Method.hs
@@ -97,8 +97,6 @@ class ( Typeable req, Typeable resp
97 ) 97 )
98 => KRPC req resp | req -> resp, resp -> req where 98 => KRPC req resp | req -> resp, resp -> req where
99 99
100 type Envelope req resp
101
102 -- | Method name. Default implementation uses lowercased @req@ 100 -- | Method name. Default implementation uses lowercased @req@
103 -- datatype name. 101 -- datatype name.
104 -- 102 --
@@ -111,6 +109,3 @@ class ( Typeable req, Typeable resp
111 where 109 where
112 hole = error "krpc.method: impossible" :: req 110 hole = error "krpc.method: impossible" :: req
113#endif 111#endif
114
115 unseal :: Envelope req resp -> Either String req
116 seal :: resp -> Envelope req resp