diff --git a/zenoh/src/api/session.rs b/zenoh/src/api/session.rs index f2d9aad4f3..95ac69cfb4 100644 --- a/zenoh/src/api/session.rs +++ b/zenoh/src/api/session.rs @@ -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, @@ -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. @@ -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, @@ -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, @@ -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); @@ -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 { diff --git a/zenoh/src/net/routing/dispatcher/token.rs b/zenoh/src/net/routing/dispatcher/token.rs index d24d3666ea..fa502e3744 100644 --- a/zenoh/src/net/routing/dispatcher/token.rs +++ b/zenoh/src/net/routing/dispatcher/token.rs @@ -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 {}!", diff --git a/zenoh/src/net/routing/hat/linkstate_peer/token.rs b/zenoh/src/net/routing/hat/linkstate_peer/token.rs index 0a010ff6c8..13c71f8044 100644 --- a/zenoh/src/net/routing/hat/linkstate_peer/token.rs +++ b/zenoh/src/net/routing/hat/linkstate_peer/token.rs @@ -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, @@ -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, diff --git a/zenoh/src/net/routing/hat/router/token.rs b/zenoh/src/net/routing/hat/router/token.rs index 79184bbe7d..65a59f1ef9 100644 --- a/zenoh/src/net/routing/hat/router/token.rs +++ b/zenoh/src/net/routing/hat/router/token.rs @@ -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, @@ -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, @@ -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 {