diff options
Diffstat (limited to 'src/Network/BitTorrent/Exchange/Message.hs')
-rw-r--r-- | src/Network/BitTorrent/Exchange/Message.hs | 18 |
1 files changed, 18 insertions, 0 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 | -----------------------------------------------------------------------} |