Skip to content

Commit

Permalink
Remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierHecart committed Jun 4, 2024
1 parent ef360ce commit e32242c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 58 deletions.
31 changes: 1 addition & 30 deletions zenoh/src/api/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -944,11 +944,6 @@ impl Session {
let expr_id = state.expr_id_counter.fetch_add(1, Ordering::SeqCst);
let mut res = Resource::new(Box::from(prefix));
if let Resource::Node(res_node) = &mut res {
// NOTE(fuzzypixelz): At this point, I'm not sure if
// DeclareKeyExpr is relevant to subscribers or
// liveliness subscribers. So I assume that this key
// expression can be used both for tokens and
// samples.
for kind in [
SubscriberKind::Subscriber,
SubscriberKind::LivelinessSubscriber,
Expand Down Expand Up @@ -1240,11 +1235,6 @@ impl Session {
.retain(|sub| sub.id != sub_state.id);
}

// NOTE(fuzzypixelz): I'm assuming that liveliness subscribers are
// declared and undeclared just like subscribers. The old code seems
// to have prevented liveliness subscribers from being declared
// since they have @/liveliness/* key expressions?

if sub_state.origin != Locality::SessionLocal && kind == SubscriberKind::Subscriber {
// Note: there might be several Subscribers on the same KeyExpr.
// Before calling forget_subscriber(key_expr), check if this was the last one.
Expand Down Expand Up @@ -2215,11 +2205,6 @@ impl Primitives for Session {
match state.remote_key_to_expr(&m.wire_expr) {
Ok(key_expr) => {
let mut res_node = ResourceNode::new(key_expr.clone().into());
// NOTE(fuzzypixelz): At this point, I'm not sure if
// DeclareKeyExpr is relevant to subscribers or
// liveliness subscribers. So I assume that this key
// expression can be used both for tokens and
// samples.
for kind in [
SubscriberKind::Subscriber,
SubscriberKind::LivelinessSubscriber,
Expand Down Expand Up @@ -2296,7 +2281,6 @@ impl Primitives for Session {
Ok(key_expr) => {
if let Some(interest_id) = msg.interest_id {
if let Some(query) = state.liveliness_queries.get(&interest_id) {
// NOTE(fuzzypixelz): This was shamlessly copied from `zenoh::net::routing::dispatcher::queries::route_query`
let reply = Reply {
result: Ok(Sample {
key_expr,
Expand All @@ -2310,19 +2294,13 @@ impl Primitives for Session {
#[cfg(feature = "unstable")]
attachment: None,
}),
replier_id: ZenohId::rand(), // NOTE(fuzzypixelz): The `Session::query` function does the same thing
replier_id: ZenohId::rand(),
};

(query.callback)(reply);
}
} else {
state.remote_tokens.insert(m.id, key_expr.clone());
// NOTE(fuzzypixelz): I didn't put
// self.update_status_up() here because it doesn't
// make sense. An application which declares a
// liveliness token is not a subscriber and thus
// doens't need to to be visible to publishers
// through .matching_status().

drop(state);

Expand All @@ -2349,13 +2327,6 @@ impl Primitives for Session {
{
let mut state = zwrite!(self.state);
if let Some(key_expr) = state.remote_tokens.remove(&m.id) {
// NOTE(fuzzypixelz): I didn't put
// self.update_status_down() here because it doesn't
// make sense. An application which declares a
// liveliness token is not a subscriber and thus
// doens't need to to be visible to publishers
// through .matching_status().

drop(state);

let data_info = DataInfo {
Expand Down
2 changes: 0 additions & 2 deletions zenoh/src/net/routing/dispatcher/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ pub(crate) fn declare_token(

hat_code.declare_token(&mut wtables, face, id, &mut res, node_id, interest_id);
drop(wtables);

// NOTE(fuzzypixelz): I removed all data route handling.
}
None => tracing::error!(
"{} Declare token {} for unknown scope {}!",
Expand Down
14 changes: 2 additions & 12 deletions zenoh/src/net/routing/hat/linkstate_peer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,7 @@ fn send_sourced_token_to_net_childs(
node_id: routing_context,
},
body: DeclareBody::DeclareToken(DeclareToken {
// NOTE(fuzzypixelz): In the
// subscription-based implementation of
// liveliness, a comment here stated
// that "sourced subscriptions" do not
// use ids
id: 0,
id: 0, // Sourced tokens do not use ids
wire_expr: key_expr,
}),
interest_id: None,
Expand Down Expand Up @@ -311,12 +306,7 @@ fn send_forget_sourced_token_to_net_childs(
node_id: routing_context.unwrap_or(0),
},
body: DeclareBody::UndeclareToken(UndeclareToken {
// NOTE(fuzzypixelz): In the
// subscription-based implementation of
// liveliness, a comment here stated
// that "sourced subscriptions" do not
// use ids
id: 0,
id: 0, // Sourced tokens do not use ids
ext_wire_expr: WireExprType { wire_expr },
}),
interest_id: None,
Expand Down
16 changes: 2 additions & 14 deletions zenoh/src/net/routing/hat/router/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,7 @@ fn send_sourced_token_to_net_childs(
node_id: routing_context,
},
body: DeclareBody::DeclareToken(DeclareToken {
// NOTE(fuzzypixelz): In the original
// subscriber-based liveliness
// implementation, sourced subscriptions
// don't use an id, should this be the same
// for liveliness declarators?
id: 0,
id: 0, // Sourced tokens do not use ids
wire_expr: key_expr,
}),
interest_id: None,
Expand Down Expand Up @@ -364,12 +359,7 @@ fn send_forget_sourced_token_to_net_childs(
node_id: routing_context.unwrap_or(0),
},
body: DeclareBody::UndeclareToken(UndeclareToken {
// NOTE(fuzzypixelz): In the original
// subscriber-based liveliness
// implementation, sourced subscriptions
// don't use an id, should this be the same
// for liveliness declarators?
id: 0,
id: 0, // Sourced tokens do not use ids
ext_wire_expr: WireExprType { wire_expr },
}),
interest_id: None,
Expand Down Expand Up @@ -759,8 +749,6 @@ impl HatTokenTrait for HatCode {
aggregate: bool,
) {
if mode.current() && face.whatami == WhatAmI::Client {
// NOTE(fuzzypixelz): The pub/sub routing logic only sets the interest_id to Some(..)
// if mode.future(). For token queries (i.e. if mode.current()) an id is needed.
let interest_id = (!mode.future()).then_some(id);
if let Some(res) = res.as_ref() {
if aggregate {
Expand Down

0 comments on commit e32242c

Please sign in to comment.