Skip to content

Commit

Permalink
Fix queries duplicates in p2p
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierHecart committed Feb 12, 2024
1 parent f62ff68 commit 6750ae3
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions zenoh/src/net/routing/hat/p2p_peer/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,17 +316,26 @@ impl HatQueriesTrait for HatCode {
let mres = mres.upgrade().unwrap();
let complete = DEFAULT_INCLUDER.includes(mres.expr().as_bytes(), key_expr.as_bytes());
for (sid, context) in &mres.session_ctxs {
let key_expr = Resource::get_best_key(expr.prefix, expr.suffix, *sid);
if let Some(qabl_info) = context.qabl.as_ref() {
route.push(QueryTargetQabl {
direction: (context.face.clone(), key_expr.to_owned(), NodeId::default()),
complete: if complete {
qabl_info.complete as u64
} else {
0
},
distance: 0.5,
});
if match tables.whatami {
WhatAmI::Router => context.face.whatami != WhatAmI::Router,
_ => source_type == WhatAmI::Client || context.face.whatami == WhatAmI::Client,
} {
let key_expr = Resource::get_best_key(expr.prefix, expr.suffix, *sid);
if let Some(qabl_info) = context.qabl.as_ref() {
route.push(QueryTargetQabl {
direction: (
context.face.clone(),
key_expr.to_owned(),
NodeId::default(),
),
complete: if complete {
qabl_info.complete as u64
} else {
0
},
distance: 0.5,
});
}
}
}
}
Expand Down

0 comments on commit 6750ae3

Please sign in to comment.