more
This commit is contained in:
parent
3296c0fb3d
commit
e30ea50ef4
10 changed files with 49 additions and 52 deletions
|
@ -1,18 +0,0 @@
|
||||||
class DummyHashAnnouncer(object):
|
|
||||||
def __init__(self, *args):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def run_manage_loop(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def stop(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def add_supplier(self, *args):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def hash_queue_size(self):
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def immediate_announce(self, *args):
|
|
||||||
pass
|
|
|
@ -1,19 +0,0 @@
|
||||||
from twisted.internet import defer
|
|
||||||
|
|
||||||
|
|
||||||
class DummyPeerFinder(object):
|
|
||||||
"""This class finds peers which have announced to the DHT that they have certain blobs"""
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def run_manage_loop(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def stop(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def find_peers_for_blob(self, blob_hash):
|
|
||||||
return defer.succeed([])
|
|
||||||
|
|
||||||
def get_most_popular_hashes(self, num_to_return):
|
|
||||||
return []
|
|
|
@ -2,11 +2,9 @@ import logging
|
||||||
import miniupnpc
|
import miniupnpc
|
||||||
from twisted.internet import threads, defer
|
from twisted.internet import threads, defer
|
||||||
from lbrynet.core.BlobManager import DiskBlobManager
|
from lbrynet.core.BlobManager import DiskBlobManager
|
||||||
from lbrynet.dht import node, peerfinder, peermanager
|
from lbrynet.dht import node, peerfinder, peermanager, hashannouncer
|
||||||
from lbrynet.database.storage import SQLiteStorage
|
from lbrynet.database.storage import SQLiteStorage
|
||||||
from lbrynet.core.RateLimiter import RateLimiter
|
from lbrynet.core.RateLimiter import RateLimiter
|
||||||
from lbrynet.core.HashAnnouncer import DummyHashAnnouncer
|
|
||||||
from lbrynet.dht.hashannouncer import DHTHashAnnouncer
|
|
||||||
from lbrynet.core.utils import generate_id
|
from lbrynet.core.utils import generate_id
|
||||||
from lbrynet.core.PaymentRateManager import BasePaymentRateManager, NegotiatedPaymentRateManager
|
from lbrynet.core.PaymentRateManager import BasePaymentRateManager, NegotiatedPaymentRateManager
|
||||||
from lbrynet.core.BlobAvailability import BlobAvailabilityTracker
|
from lbrynet.core.BlobAvailability import BlobAvailabilityTracker
|
||||||
|
@ -162,7 +160,7 @@ class Session(object):
|
||||||
else:
|
else:
|
||||||
if self.hash_announcer is None and self.peer_port is not None:
|
if self.hash_announcer is None and self.peer_port is not None:
|
||||||
log.warning("The server has no way to advertise its available blobs.")
|
log.warning("The server has no way to advertise its available blobs.")
|
||||||
self.hash_announcer = DummyHashAnnouncer()
|
self.hash_announcer = hashannouncer.DummyHashAnnouncer()
|
||||||
|
|
||||||
d.addCallback(lambda _: self._setup_other_components())
|
d.addCallback(lambda _: self._setup_other_components())
|
||||||
return d
|
return d
|
||||||
|
@ -296,7 +294,7 @@ class Session(object):
|
||||||
)
|
)
|
||||||
self.peer_finder = peerfinder.DHTPeerFinder(self.dht_node, self.peer_manager)
|
self.peer_finder = peerfinder.DHTPeerFinder(self.dht_node, self.peer_manager)
|
||||||
if self.hash_announcer is None:
|
if self.hash_announcer is None:
|
||||||
self.hash_announcer = DHTHashAnnouncer(self.dht_node, self.peer_port)
|
self.hash_announcer = hashannouncer.DHTHashAnnouncer(self.dht_node, self.peer_port)
|
||||||
|
|
||||||
self.dht_node.startNetwork()
|
self.dht_node.startNetwork()
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,14 @@ from twisted.internet import defer, threads, reactor
|
||||||
|
|
||||||
from lbrynet.blob import BlobFile
|
from lbrynet.blob import BlobFile
|
||||||
from lbrynet.core.BlobManager import DiskBlobManager
|
from lbrynet.core.BlobManager import DiskBlobManager
|
||||||
from lbrynet.core.HashAnnouncer import DummyHashAnnouncer
|
|
||||||
from lbrynet.core.RateLimiter import DummyRateLimiter
|
from lbrynet.core.RateLimiter import DummyRateLimiter
|
||||||
from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager
|
from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager
|
||||||
from lbrynet.core.PeerFinder import DummyPeerFinder
|
|
||||||
from lbrynet.core.client.BlobRequester import BlobRequester
|
from lbrynet.core.client.BlobRequester import BlobRequester
|
||||||
from lbrynet.core.client.StandaloneBlobDownloader import StandaloneBlobDownloader
|
from lbrynet.core.client.StandaloneBlobDownloader import StandaloneBlobDownloader
|
||||||
from lbrynet.core.client.ConnectionManager import ConnectionManager
|
from lbrynet.core.client.ConnectionManager import ConnectionManager
|
||||||
|
from lbrynet.dht.hashannouncer import DummyHashAnnouncer
|
||||||
|
from lbrynet.dht.peerfinder import DummyPeerFinder
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,27 @@ from lbrynet.core import utils
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class DHTHashAnnouncer(object):
|
class DummyHashAnnouncer(object):
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def run_manage_loop(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def add_supplier(self, supplier):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def hash_queue_size(self):
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def immediate_announce(self, blob_hashes):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class DHTHashAnnouncer(DummyHashAnnouncer):
|
||||||
ANNOUNCE_CHECK_INTERVAL = 60
|
ANNOUNCE_CHECK_INTERVAL = 60
|
||||||
CONCURRENT_ANNOUNCERS = 5
|
CONCURRENT_ANNOUNCERS = 5
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,23 @@ from lbrynet.core.utils import short_hash
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class DHTPeerFinder(object):
|
class DummyPeerFinder(object):
|
||||||
|
"""This class finds peers which have announced to the DHT that they have certain blobs"""
|
||||||
|
|
||||||
|
def run_manage_loop(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def find_peers_for_blob(self, blob_hash):
|
||||||
|
return defer.succeed([])
|
||||||
|
|
||||||
|
def get_most_popular_hashes(self, num_to_return):
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
class DHTPeerFinder(DummyPeerFinder):
|
||||||
"""This class finds peers which have announced to the DHT that they have certain blobs"""
|
"""This class finds peers which have announced to the DHT that they have certain blobs"""
|
||||||
implements(IPeerFinder)
|
implements(IPeerFinder)
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ from twisted.internet import defer, threads
|
||||||
|
|
||||||
from lbrynet.tests.util import random_lbry_hash
|
from lbrynet.tests.util import random_lbry_hash
|
||||||
from lbrynet.core.BlobManager import DiskBlobManager
|
from lbrynet.core.BlobManager import DiskBlobManager
|
||||||
from lbrynet.core.HashAnnouncer import DummyHashAnnouncer
|
from lbrynet.dht.hashannouncer import DummyHashAnnouncer
|
||||||
from lbrynet.database.storage import SQLiteStorage
|
from lbrynet.database.storage import SQLiteStorage
|
||||||
from lbrynet.core.Peer import Peer
|
from lbrynet.core.Peer import Peer
|
||||||
from lbrynet import conf
|
from lbrynet import conf
|
||||||
|
|
|
@ -14,7 +14,7 @@ from lbrynet.core import log_support, Wallet, Peer
|
||||||
from lbrynet.core.SinglePeerDownloader import SinglePeerDownloader
|
from lbrynet.core.SinglePeerDownloader import SinglePeerDownloader
|
||||||
from lbrynet.core.StreamDescriptor import BlobStreamDescriptorReader
|
from lbrynet.core.StreamDescriptor import BlobStreamDescriptorReader
|
||||||
from lbrynet.core.BlobManager import DiskBlobManager
|
from lbrynet.core.BlobManager import DiskBlobManager
|
||||||
from lbrynet.core.HashAnnouncer import DummyHashAnnouncer
|
from lbrynet.dht.hashannouncer import DummyHashAnnouncer
|
||||||
|
|
||||||
log = logging.getLogger()
|
log = logging.getLogger()
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,11 @@ import sys
|
||||||
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
from twisted.protocols import basic
|
|
||||||
from twisted.web.client import FileBodyProducer
|
from twisted.web.client import FileBodyProducer
|
||||||
|
|
||||||
from lbrynet import conf
|
from lbrynet import conf
|
||||||
from lbrynet.core import log_support
|
from lbrynet.core import log_support
|
||||||
from lbrynet.core.HashAnnouncer import DummyHashAnnouncer
|
from lbrynet.dht.hashannouncer import DummyHashAnnouncer
|
||||||
from lbrynet.core.BlobManager import DiskBlobManager
|
from lbrynet.core.BlobManager import DiskBlobManager
|
||||||
from lbrynet.cryptstream.CryptStreamCreator import CryptStreamCreator
|
from lbrynet.cryptstream.CryptStreamCreator import CryptStreamCreator
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ from twisted.protocols import basic
|
||||||
|
|
||||||
from lbrynet import conf
|
from lbrynet import conf
|
||||||
from lbrynet.core import BlobManager
|
from lbrynet.core import BlobManager
|
||||||
from lbrynet.core import HashAnnouncer
|
from lbrynet.dht import hashannouncer
|
||||||
from lbrynet.core import log_support
|
from lbrynet.core import log_support
|
||||||
from lbrynet.cryptstream import CryptStreamCreator
|
from lbrynet.cryptstream import CryptStreamCreator
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ def reseed_file(input_file, sd_blob):
|
||||||
sd_blob = SdBlob.new_instance(sd_blob)
|
sd_blob = SdBlob.new_instance(sd_blob)
|
||||||
db_dir = conf.settings['data_dir']
|
db_dir = conf.settings['data_dir']
|
||||||
blobfile_dir = os.path.join(db_dir, "blobfiles")
|
blobfile_dir = os.path.join(db_dir, "blobfiles")
|
||||||
announcer = HashAnnouncer.DummyHashAnnouncer()
|
announcer = hashannouncer.DummyHashAnnouncer()
|
||||||
blob_manager = BlobManager.DiskBlobManager(announcer, blobfile_dir, db_dir)
|
blob_manager = BlobManager.DiskBlobManager(announcer, blobfile_dir, db_dir)
|
||||||
yield blob_manager.setup()
|
yield blob_manager.setup()
|
||||||
creator = CryptStreamCreator.CryptStreamCreator(
|
creator = CryptStreamCreator.CryptStreamCreator(
|
||||||
|
|
Loading…
Reference in a new issue