Closed gubatron closed 1 month ago
Development branch libtorrent-2.0 started.
./build-macos.sh
works, ./gradlew test
is passing all existing tests.
Have yet to test the library on FrostWire and see if FrostWire compiles and then will start making a battery of tests, fixing and adding new tests on this project.
Will start a development branch libtorrent-2.0 to attempt to upgrade to libtorrent 2.0.
With libtorrent 2 we'll be supporting BitTorrent v2 and this gives us:
urn:btmh
, look likemagnet:?xt=urn:btmh:<tagged-info-hash>&dn=<name>&tr=<tracker-url>
. "mh" stands formulti-hash
format encoded in hexadecimal. It will have a two byte prefix of0x12 0x20
and it's possible to include both a v1 (btih) and v2 (btmh) infohashes in a magnet for backwards compatibility.Default disk I/O in libtorrent 2.0 uses memory mapped files, a lot of what used to be handled by libtorrent's disk caching subsystem is now handled by the underlying OS kernel, this simplifies the disk code and makes it more efficient when using modern disks and physical memory. The disk subsystem is also not threaded and more primitive than a memory mapped one. Hopefully, this won't be an issue with Android's file system, and in that case we'll have to implement a custom
disk_interface
and configure it when creating the session, instead of thestorage_interface
.According to the libtorrent site, we have to do the following things:
cxxtd=14
(We are building with c++17)add_torrent_params::info_hash
deprecated in favor ofadd_torrent_params::info_hashes
which now uses aninfo_hash_t
parameter which bundles both a SHA-1 and SHA-256 hash (used for hybrid torrents and magnet links with multi-hash support)torrent_removed_alert
,torrent_deleted_alert
,torrent_delete_failed_alert
now haveinfo_hash_t
members, the old versions of these alerts are also deprecated.sha1_hash
of just the v1 hash.announce_entry
_ has a list of endpoints (listen sockets) announced independently. Eachannounce_endpoin
has an array ofinfo_hashes
indexed by their protocol version (thus ready for N future upgrades of the protocol)add_torrent_params
will no longer have themerkle_tree
member, and instead hasverified_leaf_hashes
andmerkle_trees
members. (I believe we don't make much use of this in jlibtorrent's higher level Java API, I might be wrong)create_torrent
class creates hybryd torrents by default. passing thev1_only
orv2_only
flag allows for the creation of non-hybrid torrents.pad_file_limit
andalignment
parameters forcreate_torrent
constructor have always been removed.mutable_torrent_support
flag is also always onset_file_hash
andfile_hash()
functions are obsolete, v12 torrents have afile_root()
for each file (the merkle root of the sha256 pieces tree.socket_type_t
enum used to identify different kinds of sockets.udp
has been deprecated in favor ofutp
.socket_type_t
is now used bypeer_connect_alert
,peer_disconnected_alert
,incoming_connection_alert
,listen_failed_alert
,listen_succeeded_alert
settings_pack
,lt::dht::dht_settings
is now deprecated in favor ofdht_*
insettings_pack
dht_settings
changes the dht custom storage constructor (seesession_params
). Instead of taking adht_settings
object, it now takes the fullsettings_pack
object.stats_alert
is deprecated, instead callsession::post_torrent_updates()
. This will post astate_update_alert
containing thetorrent_status
of all torrents that have any updates since the last time the function was called. This allows for better scalability.save_state()
andload_state()
on thesession
have been deprecated in favor of loading the session state up front usingread_session_params()
and construct thesession
from it.session
state can be acquired, in the form of asession_params
object, by callingsession::session_state()
read_session_params()
andwrite_session_params()
to serialize and de-serialize thesession_params
object.session
constructors have been deprecated in favor of the ones that take asession_params
object. Thesessions_params
object can be implicitly constructed from asettings_pack
.partial
torrent hash was used with a temporary hash of the URL until the torrent was loaded. In libtorrent 2, info-hashes cannot change. (we already do this on FrostWire ./com/frostwire/gui/bittorrent/TorrentFetcherDownload.java)add_torrent_params::url
could also be used to add torrents by magnet link. This was also deprecated in the previous version and has been removed in libtorrent 2.0. Instead, use [parse_magnet_uri()
](https://libtorrent.org/reference-Core.html#parse_magnet_uri()) to construct anadd_torrent_params
object to add to thesession
. This also allows the client to alter settings, such assave_path
, before adding the magnet link.storage_interface
when adding a torrent you can now configure a disk subsystem by implementing thedisk_interface
when creating a session. Check use oflibtorrent.i
definedadd_torrent_params.set_disabled_storage()
used inSessionManager::fetchMagnet(...)
add_torrent_params
no longer has astorage_constructor
member.cache_size
setting is no longer used. RemoveSettingsPack::cacheSize()
andSettingsPack::cacheSize(int)
methods