mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
connectd: Update connection list with new address
If we're already attempting to connect to a peer, we would ignore new connection requests. This is problematic if your node has bad connection details for the node -- you can't update it while inflight. This patch appends new connection suggestions to the list of connections to try. Fixes #4154
This commit is contained in:
33
tests/plugins/slow_start.py
Executable file
33
tests/plugins/slow_start.py
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
"""This plugin is used to check that updated connection hints work properly.
|
||||
|
||||
"""
|
||||
from pyln.client import Plugin
|
||||
|
||||
import socket
|
||||
import time
|
||||
|
||||
plugin = Plugin()
|
||||
|
||||
|
||||
@plugin.async_method('waitconn')
|
||||
def wait_connection(request, plugin):
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.bind(('localhost', 0))
|
||||
sock.listen(1)
|
||||
print("listening for connections on port {}".format(sock.getsockname()[1]))
|
||||
|
||||
# We are a one and done socket connection!
|
||||
conn, client_addr = sock.accept()
|
||||
try:
|
||||
print("connection from {}".format(client_addr))
|
||||
time.sleep(3)
|
||||
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
print("closing socket")
|
||||
sock.close()
|
||||
|
||||
|
||||
plugin.run()
|
||||
Reference in New Issue
Block a user