Skip to content

Commit

Permalink
Merge pull request lbryio#3356 from lbryio/propagate_external_ip_change
Browse files Browse the repository at this point in the history
  • Loading branch information
lyoshenka authored Jul 19, 2021
2 parents 406070a + 74116cc commit ac671a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lbry/extras/daemon/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,10 @@ async def _maintain_redirects(self):
log.info("external ip changed from %s to %s", self.external_ip, external_ip)
if external_ip:
self.external_ip = external_ip
dht_component = self.component_manager.get_component(DHT_COMPONENT)
if dht_component:
dht_node = dht_component.component
dht_node.protocol.external_ip = external_ip
# assert self.external_ip is not None # TODO: handle going/starting offline

if not self.upnp_redirects and self.upnp: # setup missing redirects
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/dht/test_node.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import time
import unittest
import typing
from lbry.testcase import AsyncioTestCase
Expand Down Expand Up @@ -92,11 +93,11 @@ async def test_ping_queue_discover(self):


class TestTemporarilyLosingConnection(AsyncioTestCase):
@unittest.SkipTest
TIMEOUT = None # not supported as it advances time
async def test_losing_connection(self):
async def wait_for(check_ok, insist, timeout=20):
start = loop.time()
while loop.time() - start < timeout:
start = time.time()
while time.time() - start < timeout:
if check_ok():
break
await asyncio.sleep(0)
Expand Down

0 comments on commit ac671a0

Please sign in to comment.