diff -U2 -r /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd/Reseed.cpp /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd/Reseed.cpp --- /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd/Reseed.cpp 2026-08-31 22:08:55.000000000 +0000 +++ /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd/Reseed.cpp 2026-08-31 20:12:40.000000000 +0000 @@ -379,5 +379,5 @@ if (bitFlag & ZIP_BIT_FLAG_DATA_DESCRIPTOR) { - auto pos = s.tellg (); + size_t pos = s.tellg (); if (!FindZipDataDescriptor (s)) { diff -U2 -r /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd_client/Torrents.cpp /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd_client/Torrents.cpp --- /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd_client/Torrents.cpp 2026-08-31 22:08:55.000000000 +0000 +++ /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd_client/Torrents.cpp 2026-08-31 20:12:40.000000000 +0000 @@ -148,11 +148,4 @@ } - static std::string CreateInteger (int64_t v) - { - std::string ret ("i"); - ret += std::to_string (v); ret += "e"; - return ret; - } - static std::string CreateDictionary (const std::vector >& items) { @@ -406,9 +399,6 @@ }); if (!len) return 0; - // save info - m_Info.resize (len); - memcpy (m_Info.data (), (const uint8_t *)buf.data (), len); // calculate info hash - SHA1 (m_Info.data (), len, m_InfoHash.data ()); + SHA1 ((const uint8_t *)buf.data (), len, m_InfoHash.data ()); return len; } @@ -1624,5 +1614,5 @@ (this->*(it->second))(buf + 1, len - 1); else - LogPrint (eLogInfo, "Torrents: Unexpected extended message type ", (int)buf[0], " received"); + LogPrint (eLogInfo, "Torrents: Unexecpetd extended message type ", (int)buf[0], " received"); } } @@ -1634,19 +1624,12 @@ } - void PeerConnection::SendExtendedMsg (uint8_t extendedMsgID, std::string_view payload, std::string_view data) + void PeerConnection::SendExtendedMsg () { - std::string str; - if (!extendedMsgID) // handshake - { - str = CreateDictionary ({{ CreateByteString ("v"), CreateByteString ("i2pd") }}); - payload = str; - } - std::vector sendBuffer (payload.length () + data.length () + 1 + 5); - htobe32buf (sendBuffer.data (), payload.length () + data.length () + 1 + 1); // length + std::string payload = CreateDictionary ({{ CreateByteString ("v"), CreateByteString ("i2pd") }}); + std::vector sendBuffer (payload.length () + 1 + 5); + htobe32buf (sendBuffer.data (), payload.length () + 1 + 1); // length sendBuffer[4] = eMessageTypeExtended; // msg ID - sendBuffer[5] = extendedMsgID; + sendBuffer[5] = 0; // handshake memcpy (sendBuffer.data () + 6, payload.data (), payload.size ()); - if (!data.empty ()) - memcpy (sendBuffer.data () + 6 + payload.size (), data.data (), data.size ()); WriteToStream (sendBuffer.data (), sendBuffer.size ()); } @@ -1654,46 +1637,5 @@ void PeerConnection::HandleUtMetadataExtension (const uint8_t * buf, size_t len) { - if (!m_Torrent) return; - int msgType = -1, piece = -1; - ParseDictionary (std::string_view ((const char *)buf, len), - [&msgType, &piece](std::string_view key, std::string_view buf)->size_t - { - if (key == "msg_type") - { - auto [value, l] = ExtractInteger (buf); - if (!l) msgType = value; - return l; - } - else if (key == "piece") - { - auto [value, l] = ExtractInteger (buf); - if (!l) piece = value; - return l; - } - return 0; - }); - if (msgType >=0 && piece >= 0) - { - switch (msgType) - { - case 0: - { - auto& info = m_Torrent->GetInfo (); - size_t offset = piece*REQUEST_BLOCK_SIZE; - if (offset < info.size ()) - { - size_t totalSize = std::min (info.size () - offset, REQUEST_BLOCK_SIZE); - SendExtendedMsg (3, // TODO: msgID from table - CreateDictionary ({{ CreateByteString ("msg_type"), CreateInteger (1) }, - { CreateByteString ("piece"), CreateInteger (piece) }, - { CreateByteString ("total_size"), CreateInteger (totalSize) } }), - std::string_view ((const char *)info.data () + offset, totalSize)); - } - break; - } - default: - LogPrint (eLogInfo, "Torrents: ut_metadata msg_type ", msgType, " is not supported"); - } - } + // TODO: } diff -U2 -r /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd_client/Torrents.h /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd_client/Torrents.h --- /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd_client/Torrents.h 2026-08-31 22:08:55.000000000 +0000 +++ /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd_client/Torrents.h 2026-08-31 20:12:40.000000000 +0000 @@ -176,5 +176,4 @@ size_t GetPieceLength () const { return m_PieceLength; } int GetInterval (size_t trackerID) const { return (trackerID < m_TrackerStats.size ()) ? std::get<1>(m_TrackerStats[trackerID]) : MIN_TRACKER_REQUESTS_INTERVAL; } - const std::vector GetInfo () const { return m_Info; } const InfoHash& GetInfoHash () const { return m_InfoHash; } size_t GetLeft () const; @@ -234,5 +233,4 @@ std::filesystem::path m_FullPath; size_t m_Length, m_PieceLength; - std::vector m_Info; // for BEP9 InfoHash m_InfoHash; // SHA1 std::vector m_Pieces; @@ -319,5 +317,5 @@ void HandleChokeMsg (); void HandleExtendedMsg (const uint8_t * buf, size_t len); - void SendExtendedMsg (uint8_t extendedMsgID = 0, std::string_view payload = "", std::string_view data = ""); + void SendExtendedMsg (); void AddExtendedMsgHandler (std::string_view extensionName, int64_t msgID); void HandleUtMetadataExtension (const uint8_t * buf, size_t len); // BEP9