rpartition->rsplit

This commit is contained in:
ThomasV 2019-01-31 19:43:42 +01:00
parent 776caeeff0
commit 0924503cb6

View file

@ -792,10 +792,10 @@ class LNWorker(PrintError):
await self.network.lnwatcher.on_network_update('network_updated') # ping watcher to check our channels await self.network.lnwatcher.on_network_update('network_updated') # ping watcher to check our channels
listen_addr = self.config.get('lightning_listen') listen_addr = self.config.get('lightning_listen')
if listen_addr: if listen_addr:
adr, colon, port = listen_addr.rpartition(':') addr, port = listen_addr.rsplit(':', 2)
if adr[0] == '[': if addr[0] == '[':
# ipv6 # ipv6
adr = adr[1:-1] addr = addr[1:-1]
async def cb(reader, writer): async def cb(reader, writer):
t = LNResponderTransport(self.node_keypair.privkey, reader, writer) t = LNResponderTransport(self.node_keypair.privkey, reader, writer)
node_id = await t.handshake() node_id = await t.handshake()
@ -807,7 +807,7 @@ class LNWorker(PrintError):
await self.network.main_taskgroup.spawn(peer.main_loop()) await self.network.main_taskgroup.spawn(peer.main_loop())
self.network.trigger_callback('ln_status') self.network.trigger_callback('ln_status')
await asyncio.start_server(cb, adr, int(port)) await asyncio.start_server(cb, addr, int(port))
while True: while True:
await asyncio.sleep(1) await asyncio.sleep(1)
now = time.time() now = time.time()