-
Notifications
You must be signed in to change notification settings - Fork 445
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
First Credit mining prototype #2064
Changes from 1 commit
7226455
168f7cc
bd87ab1
897cdff
d713895
9d3201b
24ebb7b
2184356
b7010d8
a31b923
9a87521
6600773
d7d9ccf
ae7576c
9b9c01a
c2e894b
a33b4c7
6cc9d7d
2310579
a85ab3c
66eb87f
57e8636
b11fd65
b9d1940
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- implement "feedback" (random) policy if we can't determine the actual policy - implement get_source_object to get source by flexible input (string/binary) - put DownloadState recent value into sources and update variable related with it.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,3 +244,56 @@ def fix_torrent(file_path): | |
fixed_data = bencode(fixed_data) | ||
|
||
return fixed_data | ||
|
||
def translate_peers_into_health(peer_info_dicts, status=None): | ||
# peer_info_dicts is a peer_info dictionary from LibTorrentDownloadImpl.create_peerlist_data | ||
# status is libtorrent torrent status #TODO : unused for now | ||
# purpose : where we want to measure a swarm's health but no tracker can be contacted | ||
|
||
num_seeders = 0 | ||
num_leech = 0 | ||
|
||
num_all_peer = len(peer_info_dicts) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it's necessary to create a variables just to hold the length of this dict since |
||
|
||
upload_only = 0 | ||
finished = 0 | ||
unfinished_able_dl = 0 | ||
interest_in_us = 0 | ||
|
||
# collecting some statistics | ||
for p_info in peer_info_dicts: | ||
upload_only_b = False | ||
finished_b = False | ||
interest_in_us_b = False | ||
|
||
if p_info['upload_only']: | ||
upload_only+=1 | ||
upload_only_b = True | ||
if p_info['uinterested']: | ||
interest_in_us+=1 | ||
interest_in_us_b = True | ||
|
||
if p_info['completed'] == 1: | ||
finished+=1 | ||
finished_b = True | ||
else: | ||
unfinished_able_dl += 1 if upload_only_b else 0 | ||
|
||
''' | ||
seeders potentials: | ||
1. it's only want uploading right now (upload only) | ||
2. it's finished (we don't know whether it want to upload or not) | ||
|
||
|
||
leecher potentials: | ||
1. it's interested in our piece | ||
2. it's unfinished but it's not 'upload only' (it can't leech for some reason) | ||
3. it's unfinished (less restrictive) | ||
|
||
make sure to change those description when change the algorithm | ||
''' | ||
|
||
num_seeders = max(upload_only, finished) | ||
num_leech = max(interest_in_us, min(unfinished_able_dl, num_all_peer - finished)) | ||
return (num_seeders, num_leech) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[Tribler.Policies.BoostingManager] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove these files, they are accidentally pushed I guess? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it's part of the 'identifier' of the configuration file |
||
max_torrents_per_source = 100 | ||
max_torrents_per_source = 10 | ||
max_torrents_active = 20 | ||
source_interval = 300 | ||
swarm_interval = 300 | ||
|
@@ -9,5 +9,5 @@ logging_interval = 60 | |
boosting_sources = ["http:https://bt.etree.org/rss/bt_etree_org.rdf"] | ||
boosting_enabled = ["http:https://bt.etree.org/rss/bt_etree_org.rdf"] | ||
boosting_disabled = [] | ||
policy = random | ||
policy = seederratio | ||
|
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.
The assigned value of these variables are not used so these two lines could be removed.