Skip to content
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

Merged
merged 50 commits into from
May 13, 2022

Conversation

shyba
Copy link
Member

@shyba shyba commented Mar 5, 2022

Small guide on how to run a tracker (should live elsewhere when ready): https://hackmd.io/@CoIkpN7DQWa6tkftkqccWA/HyxN-Z_m9

@coveralls
Copy link

coveralls commented Mar 5, 2022

Coverage Status

Coverage increased (+0.4%) to 57.383% when pulling 03b0d5e on trackers into d0e715f on master.


async def announce_forever(self):
while True:
to_sleep = 60.0
Copy link
Member

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

async def announce_forever(self):
while True:
to_sleep = 60.0
to_announce = []
Copy link
Member

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)


def decode(cls, data, offset=0):
decoder = STRUCTS[cls]
if cls == AnnounceResponse:
Copy link
Member

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?



class TrackerClient:
EVENT_CONTROLLER = StreamController()
Copy link
Member

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

ScrapeResponse = namedtuple("ScrapeResponse", ["action", "transaction_id", "items"])
ScrapeResponseItem = namedtuple("ScrapeResponseItem", ["seeders", "completed", "leechers"])
ErrorResponse = namedtuple("ErrorResponse", ["action", "transaction_id", "message"])
STRUCTS = {
Copy link
Member

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

@lbry-bot lbry-bot assigned shyba and unassigned eukreign May 13, 2022
@shyba shyba merged commit 2735484 into master May 13, 2022
@shyba shyba deleted the trackers branch May 13, 2022 20:56
@eukreign eukreign added type: new feature New functionality that does not exist yet area: DHT labels Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: DHT type: new feature New functionality that does not exist yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants