mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-10-05 23:08:01 +00:00
limit number of files per torrent. Increase max piece size to 256M
This commit is contained in:
@@ -644,7 +644,10 @@ namespace torrents
|
||||
});
|
||||
if (len && fileLength && !filePath.empty ())
|
||||
{
|
||||
m_Files.emplace_back (std::make_shared<TorrentFile> (filePath, fileLength));
|
||||
if (m_Files.size () < MAX_NUM_TORRENT_FILES)
|
||||
m_Files.emplace_back (std::make_shared<TorrentFile> (filePath, fileLength));
|
||||
else
|
||||
m_Error = eTorrentErrorMalformedMetaInfo;
|
||||
if (m_Length + fileLength <= MAX_TORRENT_LENGTH)
|
||||
m_Length += fileLength;
|
||||
else
|
||||
|
||||
@@ -37,9 +37,10 @@ namespace torrents
|
||||
{
|
||||
constexpr size_t REQUEST_BLOCK_SIZE = 16384;
|
||||
constexpr size_t MIN_PIECE_LENGTH = 16*1024; // 16K
|
||||
constexpr size_t MAX_PIECE_LENGTH = 64*1024*1024; // 64M
|
||||
constexpr size_t MAX_PIECE_LENGTH = 256*1024*1024; // 256M
|
||||
constexpr size_t MAX_NUM_TORRENT_PIECES = 1024*1024; // 1M
|
||||
constexpr size_t MAX_TORRENT_LENGTH = MAX_PIECE_LENGTH*MAX_NUM_TORRENT_PIECES; // 64T
|
||||
constexpr size_t MAX_TORRENT_LENGTH = MAX_PIECE_LENGTH*MAX_NUM_TORRENT_PIECES; // 256T
|
||||
constexpr size_t MAX_NUM_TORRENT_FILES = 10000;
|
||||
constexpr uint16_t TORRENT_PORT = 6881; // not used by required by protocol
|
||||
constexpr int MIN_TRACKER_REQUESTS_INTERVAL = 15000; // in milliseconds
|
||||
constexpr size_t PEER_CONNECTION_RECEIVE_BUFFER_SIZE = 65535;
|
||||
|
||||
Reference in New Issue
Block a user