Page 1 of 2
[Deluge 2.x] Deluge-console command update_tracker does not appear to do anything
Posted: Sat Aug 17, 2019 5:17 am
by nostyler
Hi,
I have been testing the new deluge-console command update_tracker and do not see it update the tracker. I realize this can be due to the force_reannounce method in libtorrent honoring the tracker's min-interval.
However, I have been trying to follow the code trail: in update_tracker.py it calls to core -> in core.py it calls to torrentmanager -> in torrentmanager.py the method does not appear to exist.
Can someone please take a look and nudge me in the right direction?
Re: [Deluge 2.x] Deluge-console command update_tracker does not appear to do anything
Posted: Sat Aug 17, 2019 7:54 am
by darthShadow
The function is present in libtorrent.
As for the update-tracker not working, there is another option that needs to be passed to ignore the min-interval. You could bypass the need for this option by compiling a custom libtorrent.
For
RC_1_1, you need to change
to
@
https://github.com/arvidn/libtorrent/bl ... e.cpp#L499
For
RC_1_2, you need to change
Code: Select all
static constexpr reannounce_flags_t ignore_min_interval = 0_bit;
to
Code: Select all
static constexpr reannounce_flags_t ignore_min_interval = 1_bit;
@
https://github.com/arvidn/libtorrent/bl ... .hpp#L1030
Re: [Deluge 2.x] Deluge-console command update_tracker does not appear to do anything
Posted: Sat Aug 17, 2019 10:38 am
by nostyler
Thank you - also for your explanation on Reddit.
Topic to be closed.
Re: [Deluge 2.x] Deluge-console command update_tracker does not appear to do anything
Posted: Sun Oct 17, 2021 11:11 am
by basher
Do I understand correctly this means in Deluge 1.3.x, we could
truly force-reannounce by invoking
Code: Select all
torrent.handle.force_reannounce(1, -1, 1)
At least the libtorrent method runtime signature appears to be
Code: Select all
force_reannounce(libtorrent::torrent_handle {lvalue}, int seconds=0, int tracker_idx=-1, int flags=0)
How to do this from Deluge 2, that uses libtorrent
RC_1_2+ though?
Re: [Deluge 2.x] Deluge-console command update_tracker does not appear to do anything
Posted: Sun Oct 17, 2021 6:15 pm
by mhertz
Deluge's force_reannounce() in core,py runs force_reannounce() in torrent.py, passing no args to libtorrent, so default ones used. We can change that deluge function to add a first and second arg/flag but I also thought that you had to in RC1_2 specifically change reannounce_flags_t to 1_bit and recompile, as not supporting in RC-1_2 anymore a third arg(like RC_1_1) which is the important one as you know, but I tested it nonetheless, and it seemingly works, unless i'm mistaken something.
I tested with latest debain netiso torrent, and the tracker replies back after initial announce with an interval of 900 and min-interval of 30, and by default in the deluge-function, or if changing it to self.handle.force_reannounce(1,-1,0), then when reannouncing then changes from the 15'ish minuttes countdown under next announce under tracker tab in gtkui, to 30 and if reannouncing again, then nothing happens as continues to count down - as the extra announces is scheduled for when min-interval has enountered finished, but when changing to self.handle.force_reannounce(1,-1,1), then every time pressing reannounce, then it resets back to 15 minuttes,and continues listing 'announce OK,' so seemingly min-interval ignorred, as per the additional flag defined.
If i'm wrong though, then sorry, but just to me looks like working.
From:
Code: Select all
def force_reannounce(self):
"""Force a tracker reannounce"""
try:
self.handle.force_reannounce()
except RuntimeError as ex:
log.debug('Unable to force reannounce: %s', ex)
return False
return True
Into:
Code: Select all
def force_reannounce(self):
"""Force a tracker reannounce"""
try:
self.handle.force_reannounce(1,-1,1)
except RuntimeError as ex:
log.debug('Unable to force reannounce: %s', ex)
return False
return True
In '../deluge/core/torrent.py', line 1330(1339 in develop branch).
Re: [Deluge 2.x] Deluge-console command update_tracker does not appear to do anything
Posted: Sun Oct 17, 2021 7:10 pm
by basher
Ah nice! Just to confirm, you tested it with Deluge 2 right? I tested with Deluge 1 and it seemed to work, but wasn't sure what the 3rd
flags argument type should be when used in Deluge2, as for libtorrent RC_1_1 it's
this, yet for RC_1_2 it's
this (both links are mentioned in the 2nd post of this thread).
Note in
libtorrent docs we can see the method signature as
Code: Select all
void force_reannounce (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;
Wasn't sure what
reannounce_flags_t type really is. But if you confirm
handle.force_reannounce(1,-1,1) works with Deluge2 the same as it does with Deluge1, then all seems good!
Another point to whoever might be interested, is that there's no real need to recompile Deluge itself. Eg from plugins you can always invoke this forced reannounce by
deluge_torrent_reference.handle.force_reannounce(1,-1,1), ie the
handle property of torrent gives you access to the underlying libtorrent reference.
Re: [Deluge 2.x] Deluge-console command update_tracker does not appear to do anything
Posted: Sun Oct 17, 2021 7:57 pm
by mhertz
Yes sorry deluge2/libtorrent 1.2.14. I don't have access to deluge1, so cannot really compare, but looks like works atleast.
I made a little stupid plugin once, forcing reannouncing all torrents after x defined time, which I should change also to utilize this - anyway thanks for bringing this to our attention
Re: [Deluge 2.x] Deluge-console command update_tracker does not appear to do anything
Posted: Sat Apr 01, 2023 5:00 pm
by basher
As of deluge 2 (that uses libtorrent RC_1_2+), the proper way to set the reannounce_flags_t is
Code: Select all
t.handle.force_reannounce(announce_seconds, announce_trkr_idx, lt.reannounce_flags_t.ignore_min_interval)
eg like
here, ie the flag should be imported from libtorrent library. This was
confirmed by libtorrent maintainer.
Re: [Deluge 2.x] Deluge-console command update_tracker does not appear to do anything
Posted: Sat Apr 01, 2023 6:37 pm
by mhertz
Thanks for clarification, appreciated!
Just a stupid question, you're not saying we cannot be lazy and use flag ints directly right, functionality-wise I mean, but rather what the
propper method is right. I'm pretty sure I tested this once(lazy method) and did ignored min interval from looks atleast, VS using other int value. I'm very noob, as known, and even more lazy, so when found could often get away with just use such values direct, and multiply even for several(instead of bitwise them, atleast for hex values), then stopped looking, but just me of-course. Still need learn the propper way of-course, so valuable for me too, for e.g PR purposes in projects where such matter, like here(deluge/Cas).
Thanks bro as said
Re: [Deluge 2.x] Deluge-console command update_tracker does not appear to do anything
Posted: Sat Apr 01, 2023 8:05 pm
by basher
Honestly I'm not 100% sure in that, but given you already tested it back when we last discussed it (and you saw the update timer being reset), I believe you're right.
So probably for the time being it's okay to pass 1 as the value, but it could become an issue if additional flags/options were added to force_reannounce()