fix: reuse RNS instance when already running; setup detects seed liveness
bridge.py / gossip.py: - Use RNS.Reticulum.get_instance() to reuse the running singleton instead of raising OSError when cmd_seed instantiates both RadicleBridge and GossipRelay with the same config_path cli.py (cmd_setup): - Added TCP port check via seed_node._port_open() to report whether the seed radicle-node is currently listening; prints start command if not - Adjusted final summary: distinguishes "all checks passed + running" from "all checks passed but not started" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
0226c00de0
commit
f71b87e34a
|
|
@ -123,8 +123,9 @@ class RadicleBridge:
|
||||||
self.rad_home = rad_home
|
self.rad_home = rad_home
|
||||||
self.state_path = state_path
|
self.state_path = state_path
|
||||||
|
|
||||||
# Initialize Reticulum
|
# Initialize Reticulum (reuse running instance if already started)
|
||||||
self.reticulum = RNS.Reticulum(config_path)
|
existing = RNS.Reticulum.get_instance()
|
||||||
|
self.reticulum = existing if existing is not None else RNS.Reticulum(config_path)
|
||||||
|
|
||||||
# Identity
|
# Identity
|
||||||
if identity is None:
|
if identity is None:
|
||||||
|
|
|
||||||
|
|
@ -676,8 +676,20 @@ def cmd_setup(args):
|
||||||
)
|
)
|
||||||
|
|
||||||
print()
|
print()
|
||||||
if ok:
|
print("Seed process...")
|
||||||
print("All checks passed. Start the bridge with:")
|
|
||||||
|
seed_listening = seed_node._port_open()
|
||||||
|
check(
|
||||||
|
f"Seed radicle-node listening on port {seed_port}",
|
||||||
|
seed_listening,
|
||||||
|
f"radicle-rns seed --seed-home {seed_home} --seed-port {seed_port}",
|
||||||
|
)
|
||||||
|
|
||||||
|
print()
|
||||||
|
if ok and seed_listening:
|
||||||
|
print("All checks passed. Seed is running.")
|
||||||
|
elif ok:
|
||||||
|
print("All checks passed. Start the seed with:")
|
||||||
print(f" radicle-rns seed")
|
print(f" radicle-rns seed")
|
||||||
else:
|
else:
|
||||||
print("Setup incomplete. Follow the instructions above, then run:")
|
print("Setup incomplete. Follow the instructions above, then run:")
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,8 @@ class GossipRelay:
|
||||||
self.auto_discover = auto_discover
|
self.auto_discover = auto_discover
|
||||||
self.rad_home = rad_home
|
self.rad_home = rad_home
|
||||||
|
|
||||||
self.reticulum = RNS.Reticulum(config_path)
|
existing = RNS.Reticulum.get_instance()
|
||||||
|
self.reticulum = existing if existing is not None else RNS.Reticulum(config_path)
|
||||||
|
|
||||||
self.destination = RNS.Destination(
|
self.destination = RNS.Destination(
|
||||||
identity.rns_identity,
|
identity.rns_identity,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue