-
Notifications
You must be signed in to change notification settings - Fork 483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for announcing and querying LBRY streams over BEP15 (BitTorrent Trackers) #3576
Conversation
eb0d481
to
d767d22
Compare
lbry/extras/daemon/components.py
Outdated
|
||
async def announce_forever(self): | ||
while True: | ||
to_sleep = 60.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better name might be sleep_time
or sleep_seconds
lbry/extras/daemon/components.py
Outdated
async def announce_forever(self): | ||
while True: | ||
to_sleep = 60.0 | ||
to_announce = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better name might be announce_sd_hashes
or sd_hashes_to_announce
(i prefer announce_sd_hashes
)
lbry/torrent/tracker.py
Outdated
|
||
def decode(cls, data, offset=0): | ||
decoder = STRUCTS[cls] | ||
if cls == AnnounceResponse: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should all of the if branches be is
instead of a ==
operator?
lbry/torrent/tracker.py
Outdated
|
||
|
||
class TrackerClient: | ||
EVENT_CONTROLLER = StreamController() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in Python only true constants are generally all caps, in this case EVENT_CONTROLLER is not a constant but a mutating object. should just be underscore case
lbry/torrent/tracker.py
Outdated
ScrapeResponse = namedtuple("ScrapeResponse", ["action", "transaction_id", "items"]) | ||
ScrapeResponseItem = namedtuple("ScrapeResponseItem", ["seeders", "completed", "leechers"]) | ||
ErrorResponse = namedtuple("ErrorResponse", ["action", "transaction_id", "message"]) | ||
STRUCTS = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be camel case or just lower case?
according to python style guide, global variable names should follow function naming scheme:
https://peps.python.org/pep-0008/#global-variable-names
…tests more reliable
…uncement abstraction
Small guide on how to run a tracker (should live elsewhere when ready): https://hackmd.io/@CoIkpN7DQWa6tkftkqccWA/HyxN-Z_m9