summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-08-03 13:10:31 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-08-03 13:10:31 +0400
commite569586521be76e0f02137e01af9375d327d461c (patch)
treea884ed66706a1dcf4c417f9d9f7d4d5b2ba3db40 /src
parent89324a02146af6e96f0cdff41ffa36ded1be487d (diff)
parentd2c9ef1c2f7acd27ab6fac9b80f6590bf0d505b9 (diff)
Merge pull request #8 from Fuuzetsu/7.8.3-fixes
7.8.3 fixes
Diffstat (limited to 'src')
-rw-r--r--src/Network/BitTorrent/DHT/Query.hs6
-rw-r--r--src/Network/BitTorrent/Tracker/RPC/HTTP.hs2
2 files changed, 2 insertions, 6 deletions
diff --git a/src/Network/BitTorrent/DHT/Query.hs b/src/Network/BitTorrent/DHT/Query.hs
index d4710ecf..f7657490 100644
--- a/src/Network/BitTorrent/DHT/Query.hs
+++ b/src/Network/BitTorrent/DHT/Query.hs
@@ -127,17 +127,13 @@ findNodeQ key NodeInfo {..} = do
127 NodeFound closest <- FindNode (toNodeId key) <@> nodeAddr 127 NodeFound closest <- FindNode (toNodeId key) <@> nodeAddr
128 return $ Right closest 128 return $ Right closest
129 129
130isLeft :: Either a b -> Bool
131isLeft (Right _) = False
132isLeft (Left _) = True
133
134getPeersQ :: Address ip => InfoHash -> Iteration ip PeerAddr 130getPeersQ :: Address ip => InfoHash -> Iteration ip PeerAddr
135getPeersQ topic NodeInfo {..} = do 131getPeersQ topic NodeInfo {..} = do
136 GotPeers {..} <- GetPeers topic <@> nodeAddr 132 GotPeers {..} <- GetPeers topic <@> nodeAddr
137 let dist = distance (toNodeId topic) nodeId 133 let dist = distance (toNodeId topic) nodeId
138 $(logInfoS) "getPeersQ" $ T.pack 134 $(logInfoS) "getPeersQ" $ T.pack
139 $ "distance: " <> render (pretty dist) <> " , result: " 135 $ "distance: " <> render (pretty dist) <> " , result: "
140 <> if isLeft peers then "NODES" else "PEERS" 136 <> case peers of { Left _ -> "NODES"; Right _ -> "PEERS" }
141 return peers 137 return peers
142 138
143announceQ :: Address ip => InfoHash -> PortNumber -> Iteration ip NodeAddr 139announceQ :: Address ip => InfoHash -> PortNumber -> Iteration ip NodeAddr
diff --git a/src/Network/BitTorrent/Tracker/RPC/HTTP.hs b/src/Network/BitTorrent/Tracker/RPC/HTTP.hs
index 6e55eb04..de3fc5f5 100644
--- a/src/Network/BitTorrent/Tracker/RPC/HTTP.hs
+++ b/src/Network/BitTorrent/Tracker/RPC/HTTP.hs
@@ -37,7 +37,7 @@ import Data.ByteString.Lazy as BL
37import Data.Default 37import Data.Default
38import Data.List as L 38import Data.List as L
39import Data.Monoid 39import Data.Monoid
40import Data.Typeable 40import Data.Typeable hiding (Proxy)
41import Network.URI 41import Network.URI
42import Network.HTTP.Conduit hiding 42import Network.HTTP.Conduit hiding
43 (Manager, newManager, closeManager, withManager) 43 (Manager, newManager, closeManager, withManager)