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

First Credit mining prototype #2064

Merged
merged 24 commits into from
Jun 28, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7226455
Channel boosting implementation
Oct 9, 2013
168f7cc
sessioncalling arg was removed a while ago.
Aug 18, 2015
bd87ab1
Updates for API changes
Aug 18, 2015
897cdff
Add missing __init__.py
Aug 18, 2015
d713895
Don't fail when a torrent not in the download list finishes.
Aug 18, 2015
9d3201b
Remove DOS newlines from BoostingManager modifications.
Aug 18, 2015
24ebb7b
WIP commit
Aug 24, 2015
2184356
WIP commit
Aug 28, 2015
b7010d8
Fix initial work in BoostingManager that cannot work
ardhipoetra Jun 27, 2016
a31b923
Revamped creditmining GUI
ardhipoetra Jun 27, 2016
9a87521
Extract peerlist to its own function
ardhipoetra Mar 18, 2016
6600773
Create function to translate peers into health
ardhipoetra Jun 27, 2016
d7d9ccf
Create holder in GUI if credit mining is not ready yet
ardhipoetra Jun 27, 2016
ae7576c
Start boosting manager if ready only
ardhipoetra Jun 27, 2016
9b9c01a
Add dirdialog for convenience choosing source
ardhipoetra Jun 27, 2016
c2e894b
Prevent GUI to do task when quitting
ardhipoetra May 9, 2016
a33b4c7
Clean onexit in BoostingManager
ardhipoetra Jun 27, 2016
6cc9d7d
Add and clean documentation in some functions needed
ardhipoetra May 3, 2016
2310579
Add credit mining preferences by SessionConfig
ardhipoetra May 27, 2016
a85ab3c
Refactor policies, constant, and function to different file
ardhipoetra May 31, 2016
66eb87f
Fix resume data to use configparser
ardhipoetra Jun 27, 2016
57e8636
Add logger.conf, Delete bootstraptribler.txt and boostchannel.py
ardhipoetra Jun 14, 2016
b11fd65
Fix switch policy when loading config
ardhipoetra Jun 8, 2016
b9d1940
Credit mining testcase
ardhipoetra Jun 27, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Credit mining testcase
This is a combination of 12 commits.
Squashed commits :
- modify testcase to fit new preferences
- Remove singleton in test
- Change test to adapt TaskManager in source
- Add test in dependencies and default load
- Move rss xml creation to separate method
- Refer channel and torrent creation to RestAPI test
- Add more Levenshtein distance test
- Add test on custom RSS parser
- Refactor test on single type parameter in BoostingManager
- Remove threading event usage in test
- Reduce timeout in RSS test
- Test cleaning pylint
  • Loading branch information
ardhipoetra committed Jun 28, 2016
commit b9d1940ff4c6991d071707c31d0f81b178682f84
3 changes: 3 additions & 0 deletions Tribler/Test/Core/CreditMining/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
This package contains tests for the credit mining-related code of Tribler.
"""
138 changes: 138 additions & 0 deletions Tribler/Test/Core/CreditMining/mock_creditmining.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
"""
Module of Credit mining mock classes
Written by Ardhi Putra Pratama H
"""
from twisted.web.resource import Resource


class MockLtTorrent(object):
"""
Class representing libtorrent handle for getting peer info
"""
def __init__(self, infohash="12345"):
self.info_hash = infohash
self.all_time_download = 0
self.all_time_upload = 0

def upload_limit(self):
return 12

def max_uploads(self):
return 13

def max_connections(self):
return 14

def piece_priorities(self):
return [0, 1, 1, 0, 1, 1, 1]

def get_peer_info(self):
"""
class returning peer info for a particular handle
"""
peer = [None] * 6
peer[0] = MockLtPeer(1, "ip1")
peer[0].setvalue(True, True, True)
peer[1] = MockLtPeer(2, "ip2")
peer[1].setvalue(False, False, True)
peer[2] = MockLtPeer(3, "ip3")
peer[2].setvalue(True, False, True)
peer[3] = MockLtPeer(4, "ip4")
peer[3].setvalue(False, True, False)
peer[4] = MockLtPeer(5, "ip5")
peer[4].setvalue(False, True, True)
peer[5] = MockLtPeer(6, "ip6")
peer[5].setvalue(False, False, False)
return peer

def is_valid(self):
"""
check whether the handle is valid or not
"""
return True

def status(self):
return self

class MockLtPeer(object):
"""
Dummy peer object returned by libtorrent python binding
"""
def __init__(self, pid, ip):
self.pid = pid
self.client = 2
self.ip = [ip, "port"]
self.flags = 1
self.local_connection = True
self.payload_up_speed = 0
self.remote_interested = 1
self.remote_choked = 1
self.upload_queue_length = 0
self.used_send_buffer = 0
self.payload_down_speed = 0
self.interesting = True
self.choked = True
self.total_upload = 0
self.total_download = 0
self.progress = 0
self.pieces = 0
self.remote_dl_rate = 0
self.country = "ID"
self.connection_type = 0
self.seed = 1
self.upload_only = 1
self.read_state = False
self.write_state = False

def setvalue(self, upload_only, uinterested, completed):
self.upload_only = upload_only
self.remote_interested = uinterested
self.progress = 1 if completed else 0


class MockMeta(object):
"""
class for mocking the torrent metainfo
"""

def __init__(self, id_hash):
self.infohash = id_hash

def get_infohash(self):
"""
returning infohash of torrents
"""
return self.infohash


class MockLtSession(object):
"""
Mock for session and LibTorrentMgr
"""
def __init__(self):
pass

def get_session(self):
"""
supposed to get libtorrent session
"""
return self

def set_settings(self, _):
"""
set settings (don't do anything)
"""
pass

def shutdown(self):
"""
obligatory shutdown function
"""
pass


class ResourceFailClass(Resource):
def render_GET(self, request):
request.setResponseCode(503)
return "<html><body>Error 503.</body></html>"
Loading