Skip to content

Commit

Permalink
Fix linkstate bugs when gossip multihop is disabled (#390)
Browse files Browse the repository at this point in the history
* Don't send all nodes on new link if gossip multihop is disabled

* Fix linkstate bugs when gossip multihop is disabled
  • Loading branch information
OlivierHecart authored Dec 6, 2022
1 parent 6ea5275 commit 1980f3d
Showing 1 changed file with 37 additions and 23 deletions.
60 changes: 37 additions & 23 deletions zenoh/src/net/routing/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ impl Network {
})
.for_each(|link| {
self.send_on_link(
if new {
if new || (!self.full_linkstate && !self.gossip_multihop) {
vec![
(
idx,
Expand Down Expand Up @@ -755,18 +755,26 @@ impl Network {
let idxs = self
.graph
.node_indices()
.map(|idx| {
(
idx,
Details {
zid: true,
locators: self.propagate_locators(idx),
links: self.full_linkstate
|| (self.router_peers_failover_brokering
&& idx == self.idx
&& whatami == WhatAmI::Router),
},
)
.filter_map(|idx| {
(self.full_linkstate
|| self.gossip_multihop
|| self.links.values().any(|link| link.zid == zid)
|| (self.router_peers_failover_brokering
&& idx == self.idx
&& whatami == WhatAmI::Router))
.then(|| {
(
idx,
Details {
zid: true,
locators: self.propagate_locators(idx),
links: self.full_linkstate
|| (self.router_peers_failover_brokering
&& idx == self.idx
&& whatami == WhatAmI::Router),
},
)
})
})
.collect();
self.send_on_link(idxs, &transport);
Expand Down Expand Up @@ -806,17 +814,23 @@ impl Network {
if let Some(idx) = self.get_idx(zid) {
self.graph.remove_node(idx);
}
self.send_on_links(
vec![(
self.idx,
Details {
zid: false,
locators: self.gossip,
links: true,
if self.router_peers_failover_brokering {
self.send_on_links(
vec![(
self.idx,
Details {
zid: false,
locators: self.gossip,
links: true,
},
)],
|link| {
link.zid != *zid
&& link.transport.get_whatami().unwrap_or(WhatAmI::Peer)
== WhatAmI::Router
},
)],
|link| link.zid != *zid,
);
);
}
vec![]
}
}
Expand Down

0 comments on commit 1980f3d

Please sign in to comment.