diff --git a/lbry/conf.py b/lbry/conf.py index 6e1081a91..afd648193 100644 --- a/lbry/conf.py +++ b/lbry/conf.py @@ -577,9 +577,14 @@ class Config(CLIConfig): ) # servers - reflector_servers = Servers("Reflector re-hosting servers", [ + reflector_servers = Servers("Reflector re-hosting servers for mirroring publishes", [ ('reflector.lbry.com', 5566) ]) + + fixed_peers = Servers("Fixed peers to fall back to if none are found on P2P for a blob", [ + ('cdn.reflector.lbry.com', 5567) + ]) + lbryum_servers = Servers("SPV wallet servers", [ ('spv11.lbry.com', 50001), ('spv12.lbry.com', 50001), diff --git a/lbry/extras/daemon/analytics.py b/lbry/extras/daemon/analytics.py index 828112396..f6983016c 100644 --- a/lbry/extras/daemon/analytics.py +++ b/lbry/extras/daemon/analytics.py @@ -66,7 +66,7 @@ def _download_properties(conf: Config, external_ip: str, resolve_duration: float "node_rpc_timeout": conf.node_rpc_timeout, "peer_connect_timeout": conf.peer_connect_timeout, "blob_download_timeout": conf.blob_download_timeout, - "use_fixed_peers": len(conf.reflector_servers) > 0, + "use_fixed_peers": len(conf.fixed_peers) > 0, "fixed_peer_delay": fixed_peer_delay, "added_fixed_peers": added_fixed_peers, "active_peer_count": active_peer_count, diff --git a/lbry/stream/downloader.py b/lbry/stream/downloader.py index 588263b0e..94537e034 100644 --- a/lbry/stream/downloader.py +++ b/lbry/stream/downloader.py @@ -51,15 +51,15 @@ class StreamDownloader: def _delayed_add_fixed_peers(): self.added_fixed_peers = True self.peer_queue.put_nowait([ - make_kademlia_peer(None, address, None, tcp_port=port + 1, allow_localhost=True) + make_kademlia_peer(None, address, None, tcp_port=port, allow_localhost=True) for address, port in addresses ]) - if not self.config.reflector_servers: + if not self.config.fixed_peers: return addresses = [ - (await resolve_host(url, port + 1, proto='tcp'), port) - for url, port in self.config.reflector_servers + (await resolve_host(url, port, proto='tcp'), port) + for url, port in self.config.fixed_peers ] if 'dht' in self.config.components_to_skip or not self.node or not \ len(self.node.protocol.routing_table.get_peers()) > 0: diff --git a/lbry/testcase.py b/lbry/testcase.py index dcdaa83e5..6dc1e2eb9 100644 --- a/lbry/testcase.py +++ b/lbry/testcase.py @@ -386,6 +386,7 @@ class CommandTestCase(IntegrationTestCase): conf.blockchain_name = 'lbrycrd_regtest' conf.lbryum_servers = [('127.0.0.1', 50001)] conf.reflector_servers = [('127.0.0.1', 5566)] + conf.fixed_peers = [('127.0.0.1', 5567)] conf.known_dht_nodes = [] conf.blob_lru_cache_size = self.blob_lru_cache_size conf.components_to_skip = [ diff --git a/tests/unit/blob_exchange/test_transfer_blob.py b/tests/unit/blob_exchange/test_transfer_blob.py index fab7a4db0..b6339f375 100644 --- a/tests/unit/blob_exchange/test_transfer_blob.py +++ b/tests/unit/blob_exchange/test_transfer_blob.py @@ -34,13 +34,13 @@ class BlobExchangeTestBase(AsyncioTestCase): self.addCleanup(shutil.rmtree, self.client_dir) self.addCleanup(shutil.rmtree, self.server_dir) self.server_config = Config(data_dir=self.server_dir, download_dir=self.server_dir, wallet=self.server_dir, - reflector_servers=[]) + fixed_peers=[]) self.server_storage = SQLiteStorage(self.server_config, os.path.join(self.server_dir, "lbrynet.sqlite")) self.server_blob_manager = BlobManager(self.loop, self.server_dir, self.server_storage, self.server_config) self.server = BlobServer(self.loop, self.server_blob_manager, 'bQEaw42GXsgCAGio1nxFncJSyRmnztSCjP') self.client_config = Config(data_dir=self.client_dir, download_dir=self.client_dir, wallet=self.client_dir, - reflector_servers=[]) + fixed_peers=[]) self.client_storage = SQLiteStorage(self.client_config, os.path.join(self.client_dir, "lbrynet.sqlite")) self.client_blob_manager = BlobManager(self.loop, self.client_dir, self.client_storage, self.client_config) self.client_peer_manager = PeerManager(self.loop) diff --git a/tests/unit/stream/test_stream_manager.py b/tests/unit/stream/test_stream_manager.py index 3299bcb4d..8c17f61e4 100644 --- a/tests/unit/stream/test_stream_manager.py +++ b/tests/unit/stream/test_stream_manager.py @@ -187,7 +187,7 @@ class TestStreamManager(BlobExchangeTestBase): await self._test_time_to_first_bytes(check_post) async def test_fixed_peer_delay_dht_peers_found(self): - self.client_config.reflector_servers = [(self.server_from_client.address, self.server_from_client.tcp_port - 1)] + self.client_config.fixed_peers = [(self.server_from_client.address, self.server_from_client.tcp_port)] server_from_client = None self.server_from_client, server_from_client = server_from_client, self.server_from_client @@ -231,7 +231,7 @@ class TestStreamManager(BlobExchangeTestBase): await self._test_time_to_first_bytes(check_post, DownloadSDTimeoutError, after_setup=after_setup) async def test_override_fixed_peer_delay_dht_disabled(self): - self.client_config.reflector_servers = [(self.server_from_client.address, self.server_from_client.tcp_port - 1)] + self.client_config.fixed_peers = [(self.server_from_client.address, self.server_from_client.tcp_port)] self.client_config.components_to_skip = ['dht', 'hash_announcer'] self.client_config.fixed_peer_delay = 9001.0 self.server_from_client = None