node: restart on api/p2p ports change

This commit is contained in:
ardocrat 2024-05-15 14:15:18 +03:00
parent ae5631a717
commit 5bb03e1642
2 changed files with 9 additions and 1 deletions

View file

@ -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();

View file

@ -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::<u16>().unwrap());
if Node::is_running() {
Node::restart();
}
self.is_port_available = true;
cb.hide_keyboard();
modal.close();