summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Tracker/Message.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/Tracker/Message.hs')
-rw-r--r--src/Network/BitTorrent/Tracker/Message.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Network/BitTorrent/Tracker/Message.hs b/src/Network/BitTorrent/Tracker/Message.hs
index 95b9c7ca..0d720471 100644
--- a/src/Network/BitTorrent/Tracker/Message.hs
+++ b/src/Network/BitTorrent/Tracker/Message.hs
@@ -81,6 +81,7 @@ import Data.Default
81import Data.List as L 81import Data.List as L
82import Data.Maybe 82import Data.Maybe
83import Data.Serialize as S hiding (Result) 83import Data.Serialize as S hiding (Result)
84import Data.String
84import Data.Text (Text) 85import Data.Text (Text)
85import Data.Text.Encoding 86import Data.Text.Encoding
86import Data.Typeable 87import Data.Typeable
@@ -480,7 +481,7 @@ data AnnounceInfo =
480 481
481 -- | Human readable warning. 482 -- | Human readable warning.
482 , respWarning :: !(Maybe Text) 483 , respWarning :: !(Maybe Text)
483 } deriving (Show, Typeable) 484 } deriving (Show, Eq, Typeable)
484 485
485-- | HTTP tracker protocol compatible encoding. 486-- | HTTP tracker protocol compatible encoding.
486instance BEncode AnnounceInfo where 487instance BEncode AnnounceInfo where
@@ -535,6 +536,12 @@ instance Serialize AnnounceInfo where
535 , respPeers = PeerList peers 536 , respPeers = PeerList peers
536 } 537 }
537 538
539-- | Decodes announce response from bencoded string, for debugging only.
540instance IsString AnnounceInfo where
541 fromString str = either (error . format) id $ BE.decode (fromString str)
542 where
543 format msg = "fromString: unable to decode AnnounceInfo: " ++ msg
544
538-- | Above 25, new peers are highly unlikely to increase download 545-- | Above 25, new peers are highly unlikely to increase download
539-- speed. Even 30 peers is /plenty/, the official client version 3 546-- speed. Even 30 peers is /plenty/, the official client version 3
540-- in fact only actively forms new connections if it has less than 547-- in fact only actively forms new connections if it has less than