do more things at init time
This commit is contained in:
parent
3acf041d00
commit
b06e50a5be
1 changed files with 9 additions and 2 deletions
11
src/main.rs
11
src/main.rs
|
@ -201,8 +201,8 @@ impl Daemon {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self) -> Result<()> {
|
fn run(&self) -> Result<()> {
|
||||||
if let Err(e) = self.state.lock().unwrap().setup_wg_peers(self, 0) {
|
if let Err(e) = self.initialize() {
|
||||||
error!("Error initializing wireguard peers: {}", e);
|
error!("Error while initializing Wireguard configuration: {}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
let request = self.make_packet(&Gossip::Request)?;
|
let request = self.make_packet(&Gossip::Request)?;
|
||||||
|
@ -222,6 +222,13 @@ impl Daemon {
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn initialize(&self) -> Result<()> {
|
||||||
|
let mut state = self.state.lock().unwrap();
|
||||||
|
state.read_wg_peers(self)?;
|
||||||
|
state.setup_wg_peers(self, 0)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
fn wg_loop(&self) -> ! {
|
fn wg_loop(&self) -> ! {
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
loop {
|
loop {
|
||||||
|
|
Loading…
Reference in a new issue