Discussion:
[libtorrent] file_completed_alert is not fired in libtorrent 1.1.0
Trung Thanh Tran
2016-06-30 17:10:43 UTC
Permalink
Hi all,
When I download a torrent having a couple of files and catch file_completed_alert to know the downloaded file, this type does not exist anymore in libtorrent 1.1.0. Everything is ok in libtorrent 1.0.6. Below is my code

alerts = self.get_libtorrent_session.pop_alerts()
for alert in alerts:
alert_type = type(alert).__name__
#self.logger.info("Alert type " + alert_type)
if alert_type == "file_completed_alert":
torrent_handle = alert.handle
info_hash = torrent_handle.info_hash()

Please correct me if I am wrong.

Best regards,
Arvid Norberg
2016-07-03 15:07:14 UTC
Permalink
looking into this, it turns out this was broken during a
refactoring/optimization of the per-file progress reporting.

In 1.1 the state for keeping per-file progress counters is allocated
lazily, when asked for with torrent_handle::file_progress(). Until that
function is called, no state is maintained. This also means the trigger for
posting the file_completed_alert won't fire, because it depends on the file
progress state. I'm hesitant to revert the laziness of this, perhaps
instead is could be allocated when the alert mask indicates interest in
this alert in the first place. (i.e. alert::progress_notification).

Another thing I realized looking at this is that the progress_notification
alert category also includes some pretty verbose alerts, like requesting
and downloading blocks, which may be expensive to subscribe to just to get
file completion alerts.
Post by Trung Thanh Tran
Hi all,
When I download a torrent having a couple of files and catch
file_completed_alert to know the downloaded file, this type does not exist
anymore in libtorrent 1.1.0. Everything is ok in libtorrent 1.0.6. Below is
my code
alerts = self.get_libtorrent_session.pop_alerts()
alert_type = type(alert).__name__
#self.logger.info("Alert type " + alert_type)
torrent_handle = alert.handle
info_hash = torrent_handle.info_hash()
Please correct me if I am wrong.
Best regards,
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
--
Arvid Norberg
Arvid Norberg
2016-07-03 15:41:05 UTC
Permalink
Here's an attempted fix. https://github.com/arvidn/libtorrent/pull/880
Post by Arvid Norberg
looking into this, it turns out this was broken during a
refactoring/optimization of the per-file progress reporting.
In 1.1 the state for keeping per-file progress counters is allocated
lazily, when asked for with torrent_handle::file_progress(). Until that
function is called, no state is maintained. This also means the trigger for
posting the file_completed_alert won't fire, because it depends on the file
progress state. I'm hesitant to revert the laziness of this, perhaps
instead is could be allocated when the alert mask indicates interest in
this alert in the first place. (i.e. alert::progress_notification).
Another thing I realized looking at this is that the progress_notification
alert category also includes some pretty verbose alerts, like requesting
and downloading blocks, which may be expensive to subscribe to just to get
file completion alerts.
Post by Trung Thanh Tran
Hi all,
When I download a torrent having a couple of files and catch
file_completed_alert to know the downloaded file, this type does not exist
anymore in libtorrent 1.1.0. Everything is ok in libtorrent 1.0.6. Below is
my code
alerts = self.get_libtorrent_session.pop_alerts()
alert_type = type(alert).__name__
#self.logger.info("Alert type " + alert_type)
torrent_handle = alert.handle
info_hash = torrent_handle.info_hash()
Please correct me if I am wrong.
Best regards,
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
--
Arvid Norberg
--
Arvid Norberg
Trung Thanh Tran
2016-07-05 14:51:48 UTC
Permalink
Hi Arvid,
Thx for your response.
When will this fix be included in a release version of libtorrent? We are using 1.0.7 as stable lib.

Regards,
Here's an attempted fix. https://github.com/arvidn/libtorrent/pull/880 <https://github.com/arvidn/libtorrent/pull/880>
Post by Arvid Norberg
looking into this, it turns out this was broken during a
refactoring/optimization of the per-file progress reporting.
In 1.1 the state for keeping per-file progress counters is allocated
lazily, when asked for with torrent_handle::file_progress(). Until that
function is called, no state is maintained. This also means the trigger for
posting the file_completed_alert won't fire, because it depends on the file
progress state. I'm hesitant to revert the laziness of this, perhaps
instead is could be allocated when the alert mask indicates interest in
this alert in the first place. (i.e. alert::progress_notification).
Another thing I realized looking at this is that the progress_notification
alert category also includes some pretty verbose alerts, like requesting
and downloading blocks, which may be expensive to subscribe to just to get
file completion alerts.
Post by Trung Thanh Tran
Hi all,
When I download a torrent having a couple of files and catch
file_completed_alert to know the downloaded file, this type does not exist
anymore in libtorrent 1.1.0. Everything is ok in libtorrent 1.0.6. Below is
my code
alerts = self.get_libtorrent_session.pop_alerts()
alert_type = type(alert).__name__
#self.logger.info("Alert type " + alert_type)
torrent_handle = alert.handle
info_hash = torrent_handle.info_hash()
Please correct me if I am wrong.
Best regards,
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
--
Arvid Norberg
--
Arvid Norberg
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
Arvid Norberg
2016-07-05 21:33:03 UTC
Permalink
soon. I'm hoping to cut a 1.1.1 this coming weekend (if all goes well)
Post by Trung Thanh Tran
Hi Arvid,
Thx for your response.
When will this fix be included in a release version of libtorrent? We are
using 1.0.7 as stable lib.
Regards,
Here's an attempted fix. https://github.com/arvidn/libtorrent/pull/880 <
https://github.com/arvidn/libtorrent/pull/880>
Post by Arvid Norberg
looking into this, it turns out this was broken during a
refactoring/optimization of the per-file progress reporting.
In 1.1 the state for keeping per-file progress counters is allocated
lazily, when asked for with torrent_handle::file_progress(). Until that
function is called, no state is maintained. This also means the trigger
for
Post by Arvid Norberg
posting the file_completed_alert won't fire, because it depends on the
file
Post by Arvid Norberg
progress state. I'm hesitant to revert the laziness of this, perhaps
instead is could be allocated when the alert mask indicates interest in
this alert in the first place. (i.e. alert::progress_notification).
Another thing I realized looking at this is that the
progress_notification
Post by Arvid Norberg
alert category also includes some pretty verbose alerts, like requesting
and downloading blocks, which may be expensive to subscribe to just to
get
Post by Arvid Norberg
file completion alerts.
Post by Trung Thanh Tran
Hi all,
When I download a torrent having a couple of files and catch
file_completed_alert to know the downloaded file, this type does not
exist
Post by Arvid Norberg
Post by Trung Thanh Tran
anymore in libtorrent 1.1.0. Everything is ok in libtorrent 1.0.6.
Below is
Post by Arvid Norberg
Post by Trung Thanh Tran
my code
alerts = self.get_libtorrent_session.pop_alerts()
alert_type = type(alert).__name__
#self.logger.info("Alert type " + alert_type)
torrent_handle = alert.handle
info_hash = torrent_handle.info_hash()
Please correct me if I am wrong.
Best regards,
------------------------------------------------------------------------------
Post by Arvid Norberg
Post by Trung Thanh Tran
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech
luminaries
Post by Arvid Norberg
Post by Trung Thanh Tran
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
--
Arvid Norberg
--
Arvid Norberg
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Libtorrent-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/libtorrent-discuss
--
Arvid Norberg
Loading...