From 5bb03e164235c9964e6d422d6d1676791de0b76b Mon Sep 17 00:00:00 2001 From: ardocrat Date: Wed, 15 May 2024 14:15:18 +0300 Subject: [PATCH] node: restart on api/p2p ports change --- src/gui/views/network/setup/node.rs | 4 ++++ src/gui/views/network/setup/p2p.rs | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gui/views/network/setup/node.rs b/src/gui/views/network/setup/node.rs index a203907..2cc7fd2 100644 --- a/src/gui/views/network/setup/node.rs +++ b/src/gui/views/network/setup/node.rs @@ -318,6 +318,10 @@ impl NodeSetup { // Save port at config if it's available. NodeConfig::save_api_address(&api_ip, &self.api_port_edit); + if Node::is_running() { + Node::restart(); + } + self.is_api_port_available = true; cb.hide_keyboard(); modal.close(); diff --git a/src/gui/views/network/setup/p2p.rs b/src/gui/views/network/setup/p2p.rs index ccf015e..7222e1d 100644 --- a/src/gui/views/network/setup/p2p.rs +++ b/src/gui/views/network/setup/p2p.rs @@ -22,7 +22,7 @@ use crate::gui::platform::PlatformCallbacks; use crate::gui::views::{Modal, View}; use crate::gui::views::network::settings::NetworkSettings; use crate::gui::views::types::{ModalContainer, ModalPosition, TextEditOptions}; -use crate::node::{NodeConfig, PeersConfig}; +use crate::node::{Node, NodeConfig, PeersConfig}; /// Type of peer. #[derive(Eq, PartialEq)] @@ -310,6 +310,10 @@ impl P2PSetup { if available { NodeConfig::save_p2p_port(self.port_edit.parse::().unwrap()); + if Node::is_running() { + Node::restart(); + } + self.is_port_available = true; cb.hide_keyboard(); modal.close();