Skip to content

Commit

Permalink
Fix router panic when configured with linkstate peer routing mode (#562
Browse files Browse the repository at this point in the history
…) (#595)
  • Loading branch information
OlivierHecart authored Nov 20, 2023
1 parent d2399ca commit 1daaaf5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions zenoh/src/net/routing/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,10 @@ pub(super) fn compute_data_routes_(tables: &Tables, res: &Arc<Resource>) -> Data
compute_data_route(tables, &mut expr, Some(idx.index()), WhatAmI::Router);
}

routes.peer_data_route = Some(compute_data_route(tables, &mut expr, None, WhatAmI::Peer));
if !tables.full_net(WhatAmI::Peer) {
routes.peer_data_route =
Some(compute_data_route(tables, &mut expr, None, WhatAmI::Peer));
}
}
if (tables.whatami == WhatAmI::Router || tables.whatami == WhatAmI::Peer)
&& tables.full_net(WhatAmI::Peer)
Expand Down Expand Up @@ -1479,8 +1482,10 @@ pub(crate) fn compute_data_routes(tables: &mut Tables, res: &mut Arc<Resource>)
compute_data_route(tables, &mut expr, Some(idx.index()), WhatAmI::Router);
}

res_mut.context_mut().peer_data_route =
Some(compute_data_route(tables, &mut expr, None, WhatAmI::Peer));
if !tables.full_net(WhatAmI::Peer) {
res_mut.context_mut().peer_data_route =
Some(compute_data_route(tables, &mut expr, None, WhatAmI::Peer));
}
}
if (tables.whatami == WhatAmI::Router || tables.whatami == WhatAmI::Peer)
&& tables.full_net(WhatAmI::Peer)
Expand Down
11 changes: 8 additions & 3 deletions zenoh/src/net/routing/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,10 @@ pub(super) fn compute_query_routes_(tables: &Tables, res: &Arc<Resource>) -> Que
compute_query_route(tables, &mut expr, Some(idx.index()), WhatAmI::Router);
}

routes.peer_query_route = Some(compute_query_route(tables, &mut expr, None, WhatAmI::Peer));
if !tables.full_net(WhatAmI::Peer) {
routes.peer_query_route =
Some(compute_query_route(tables, &mut expr, None, WhatAmI::Peer));
}
}
if (tables.whatami == WhatAmI::Router || tables.whatami == WhatAmI::Peer)
&& tables.full_net(WhatAmI::Peer)
Expand Down Expand Up @@ -1595,8 +1598,10 @@ pub(crate) fn compute_query_routes(tables: &mut Tables, res: &mut Arc<Resource>)
compute_query_route(tables, &mut expr, Some(idx.index()), WhatAmI::Router);
}

res_mut.context_mut().peer_query_route =
Some(compute_query_route(tables, &mut expr, None, WhatAmI::Peer));
if !tables.full_net(WhatAmI::Peer) {
res_mut.context_mut().peer_query_route =
Some(compute_query_route(tables, &mut expr, None, WhatAmI::Peer));
}
}
if (tables.whatami == WhatAmI::Router || tables.whatami == WhatAmI::Peer)
&& tables.full_net(WhatAmI::Peer)
Expand Down

0 comments on commit 1daaaf5

Please sign in to comment.