diff --git a/libi2pd_client/Torrents.cpp b/libi2pd_client/Torrents.cpp index 6bd52f29..9c67b984 100644 --- a/libi2pd_client/Torrents.cpp +++ b/libi2pd_client/Torrents.cpp @@ -587,6 +587,16 @@ namespace torrents } else if (key == "files") return ParseFiles (buf); + else if (key == "meta version") + { + auto [value, l] = ExtractInteger (buf); + if (l && value != 1) + { + LogPrint (eLogError, "Torrents: Torrent version ", value, " is not supprted"); + m_Error = eTorrentErrorNonSupportedVersion; + } + return l; + } return 0; }); if (!len) diff --git a/libi2pd_client/Torrents.h b/libi2pd_client/Torrents.h index 86d60bbe..f625549f 100644 --- a/libi2pd_client/Torrents.h +++ b/libi2pd_client/Torrents.h @@ -239,12 +239,13 @@ namespace torrents { eTorrentErrorNoError = 0, eTorrentErrorMalformedMetaInfo = 1, + eTorrentErrorNonSupportedVersion = 2, eNumTorrentErrors }; constexpr std::array TorrentErrorStr { - "", "Malformed metaInfo" + "", "Malformed metaInfo", "Non supported version" }; using RequestedBlock = std::tuple; // (index, offset, len)