diff options
Diffstat (limited to 'src/Network')
-rw-r--r-- | src/Network/BitTorrent/Exchange/Message.hs | 18 | ||||
-rw-r--r-- | src/Network/BitTorrent/Exchange/Wire.hs | 11 |
2 files changed, 18 insertions, 11 deletions
diff --git a/src/Network/BitTorrent/Exchange/Message.hs b/src/Network/BitTorrent/Exchange/Message.hs index fee3ad36..0adb8299 100644 --- a/src/Network/BitTorrent/Exchange/Message.hs +++ b/src/Network/BitTorrent/Exchange/Message.hs | |||
@@ -81,6 +81,8 @@ module Network.BitTorrent.Exchange.Message | |||
81 | -- *** Metadata | 81 | -- *** Metadata |
82 | , ExtendedMetadata (..) | 82 | , ExtendedMetadata (..) |
83 | , metadataPieceSize | 83 | , metadataPieceSize |
84 | , defaultMetadataFactor | ||
85 | , defaultMaxInfoDictSize | ||
84 | ) where | 86 | ) where |
85 | 87 | ||
86 | import Control.Applicative | 88 | import Control.Applicative |
@@ -882,6 +884,22 @@ putMetadata msg | |||
882 | | Just bs <- getMetadataPayload msg = BE.encode msg <> BL.fromStrict bs | 884 | | Just bs <- getMetadataPayload msg = BE.encode msg <> BL.fromStrict bs |
883 | | otherwise = BE.encode msg | 885 | | otherwise = BE.encode msg |
884 | 886 | ||
887 | -- | Allows a requesting peer to send 2 'MetadataRequest's for the | ||
888 | -- each piece. | ||
889 | -- | ||
890 | -- See 'Network.BitTorrent.Wire.Options.metadataFactor' for | ||
891 | -- explanation why do we need this limit. | ||
892 | defaultMetadataFactor :: Int | ||
893 | defaultMetadataFactor = 2 | ||
894 | |||
895 | -- | Usually torrent size do not exceed 1MB. This value limit torrent | ||
896 | -- /content/ size to about 8TB. | ||
897 | -- | ||
898 | -- See 'Network.BitTorrent.Wire.Options.maxInfoDictSize' for | ||
899 | -- explanation why do we need this limit. | ||
900 | defaultMaxInfoDictSize :: Int | ||
901 | defaultMaxInfoDictSize = 10 * 1024 * 1024 | ||
902 | |||
885 | {----------------------------------------------------------------------- | 903 | {----------------------------------------------------------------------- |
886 | -- Extension protocol messages | 904 | -- Extension protocol messages |
887 | -----------------------------------------------------------------------} | 905 | -----------------------------------------------------------------------} |
diff --git a/src/Network/BitTorrent/Exchange/Wire.hs b/src/Network/BitTorrent/Exchange/Wire.hs index ef53032e..f61e59fa 100644 --- a/src/Network/BitTorrent/Exchange/Wire.hs +++ b/src/Network/BitTorrent/Exchange/Wire.hs | |||
@@ -410,17 +410,6 @@ data Options = Options | |||
410 | , maxInfoDictSize :: {-# UNPACK #-} !Int | 410 | , maxInfoDictSize :: {-# UNPACK #-} !Int |
411 | } deriving Show | 411 | } deriving Show |
412 | 412 | ||
413 | -- | Allows a requesting peer to send 2 'MetadataRequest's for the | ||
414 | -- each piece. | ||
415 | defaultMetadataFactor :: Int | ||
416 | defaultMetadataFactor = 2 | ||
417 | |||
418 | -- | Usually torrent size do not exceed 1MB. This value limit torrent | ||
419 | -- /content/ size to about 8TB. See 'maxInfoDictSize' for explanation | ||
420 | -- why do we need this limit. | ||
421 | defaultMaxInfoDictSize :: Int | ||
422 | defaultMaxInfoDictSize = 10 * 1024 * 1024 | ||
423 | |||
424 | -- | Permissive default parameters, most likely you don't need to | 413 | -- | Permissive default parameters, most likely you don't need to |
425 | -- change them. | 414 | -- change them. |
426 | instance Default Options where | 415 | instance Default Options where |