summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/DHT
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-01-25 20:48:00 -0500
committerjoe <joe@jerkface.net>2017-01-25 20:48:00 -0500
commitb3cebbedeb89fdd6b85c659360241b9251a8f1ae (patch)
tree0d9b6907ed684f1e7e5d590bbf3f068229aec8c6 /src/Network/BitTorrent/DHT
parentaf87d80ebe4cf46a1aeb0a9421708ea52d09000b (diff)
Safer exception handling in probeNode.
Diffstat (limited to 'src/Network/BitTorrent/DHT')
-rw-r--r--src/Network/BitTorrent/DHT/Query.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Network/BitTorrent/DHT/Query.hs b/src/Network/BitTorrent/DHT/Query.hs
index e0338572..8215c95d 100644
--- a/src/Network/BitTorrent/DHT/Query.hs
+++ b/src/Network/BitTorrent/DHT/Query.hs
@@ -75,6 +75,7 @@ import Data.Time.Clock.POSIX
75 75
76import Network.KRPC hiding (Options, def) 76import Network.KRPC hiding (Options, def)
77import Network.KRPC.Message (ReflectedIP(..)) 77import Network.KRPC.Message (ReflectedIP(..))
78import Network.KRPC.Manager (QueryFailure(..))
78import Data.Torrent 79import Data.Torrent
79import Network.BitTorrent.Address 80import Network.BitTorrent.Address
80import Network.BitTorrent.DHT.Message 81import Network.BitTorrent.DHT.Message
@@ -206,7 +207,7 @@ probeNode :: Address ip => NodeAddr ip -> DHT ip (Bool, Maybe ReflectedIP)
206probeNode addr = do 207probeNode addr = do
207 $(logDebugS) "routing.questionable_node" (T.pack (render (pPrint addr))) 208 $(logDebugS) "routing.questionable_node" (T.pack (render (pPrint addr)))
208 result <- try $ pingQ addr 209 result <- try $ pingQ addr
209 let _ = fmap (const ()) result :: Either SomeException () 210 let _ = fmap (const ()) result :: Either QueryFailure ()
210 return $ either (const (False,Nothing)) (\(_,mip)->(True,mip)) result 211 return $ either (const (False,Nothing)) (\(_,mip)->(True,mip)) result
211 212
212 213