Discussion:
[libtorrent] torrent_file
Michael Mckeown
2016-05-29 18:04:49 UTC
Permalink
When adding with a magnet/hash I'm looking to get the details from the
torrent_file on the state_changed_alert but:



torrent_handle handle = state_changed_alert->handle;
torrent_status status = handle.status ( );
boost::weak_ptr<const torrent_info> weak_pointer = status.torrent_file;


gives all blank/zero in the torrent_info or:



torrent_handle handle = state_changed_alert->handle;
boost::shared_ptr<const torrent_info> shared_pointer =
handle.torrent_file ( );


does the same, how is it you access the metadata from magnet/hash torrents?

has_metadata returns true on both occasions.

Thanks.

Also, the new read_resume_data() function, where exactly is it and how
is it used?

Thanks again.
Arvid Norberg
2016-05-31 00:06:29 UTC
Permalink
On Sun, May 29, 2016 at 11:04 AM, Michael Mckeown <
Post by Michael Mckeown
When adding with a magnet/hash I'm looking to get the details from the
torrent_handle handle = state_changed_alert->handle;
torrent_status status = handle.status ( );
boost::weak_ptr<const torrent_info> weak_pointer = status.torrent_file;
Can you give an example of what's zero?
number of pieces? piece_hashes? name?

Is it possible that "handle" is default constructed, i.e. not set?

torrent_handle handle = state_changed_alert->handle;
Post by Michael Mckeown
boost::shared_ptr<const torrent_info> shared_pointer =
handle.torrent_file ( );
I would expect handle to be set correctly here. You may want to double
check that the handle is valid.
Post by Michael Mckeown
does the same, how is it you access the metadata from magnet/hash torrents?
has_metadata returns true on both occasions.
is that handle.has_metadata() or status.has_metadata ?
(they should both be the same)

Could you make a minimal example that reproduces this issue?
Post by Michael Mckeown
Also, the new read_resume_data() function, where exactly is it and how
is it used?
in "libtorrent/read_resume_data.hpp"

It's used as a step before adding the torrent, to produce the
add_torrent_params object.

https://github.com/arvidn/libtorrent/blob/master/include/libtorrent/read_resume_data.hpp#L44
--
Arvid Norberg
Loading...