Commit 6c839e92 authored by nanamicat's avatar nanamicat

clean

parent ec9a95bf
Pipeline #42416 passed with stages
in 59 seconds
...@@ -29,7 +29,7 @@ pub struct Downlink { ...@@ -29,7 +29,7 @@ pub struct Downlink {
pub plan: BTreeMap<u8, BTreeMap<u8, u8>>, pub plan: BTreeMap<u8, BTreeMap<u8, u8>>,
} }
#[derive(Encode, Decode, Serialize, Copy, Clone, Debug)] #[derive(Encode, Decode, Serialize, Copy, Clone, Debug, Default)]
pub struct PeerQuality { pub struct PeerQuality {
pub delay: i16, pub delay: i16,
pub reliability: u8, pub reliability: u8,
......
...@@ -41,16 +41,7 @@ impl Router { ...@@ -41,16 +41,7 @@ impl Router {
peers: connections peers: connections
.iter() .iter()
.filter(|(_, to)| to.contains_key(&data.id)) .filter(|(_, to)| to.contains_key(&data.id))
.map(|(&from, _)| { .map(|(&from, _)| (from, Default::default()))
(
from,
PeerQuality {
delay: 0,
reliability: 0,
jitter: 0,
},
)
})
.collect(), .collect(),
via: routers.iter().filter(|r| r.id != data.id).map(|r| (r.id, r.id)).collect(), via: routers.iter().filter(|r| r.id != data.id).map(|r| (r.id, r.id)).collect(),
plan: BTreeMap::new(), plan: BTreeMap::new(),
...@@ -76,6 +67,9 @@ impl Router { ...@@ -76,6 +67,9 @@ impl Router {
} }
pub fn offline(&mut self) { pub fn offline(&mut self) {
if self.addr != None {
tracing::info!("router {} offline", self.id);
}
self.addr = None; self.addr = None;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment