diff --git a/zenoh/src/net/routing/hat/linkstate_peer/pubsub.rs b/zenoh/src/net/routing/hat/linkstate_peer/pubsub.rs index 4b76e55387..8188e2c5e6 100644 --- a/zenoh/src/net/routing/hat/linkstate_peer/pubsub.rs +++ b/zenoh/src/net/routing/hat/linkstate_peer/pubsub.rs @@ -307,6 +307,14 @@ fn send_forget_sourced_subscription_to_net_childs( fn propagate_forget_simple_subscription(tables: &mut Tables, res: &Arc) { for face in tables.faces.values_mut() { if let Some(id) = face_hat_mut!(face).local_subs.remove(res) { + // Still send WireExpr in UndeclareSubscriber to clients for pico + let ext_wire_expr = if face.whatami == WhatAmI::Client { + WireExprType { + wire_expr: Resource::get_best_key(res, "", face.id), + } + } else { + WireExprType::null() + }; face.primitives.send_declare(RoutingContext::with_expr( Declare { ext_qos: ext::QoSType::DECLARE, @@ -314,7 +322,7 @@ fn propagate_forget_simple_subscription(tables: &mut Tables, res: &Arc ext_nodeid: ext::NodeIdType::DEFAULT, body: DeclareBody::UndeclareSubscriber(UndeclareSubscriber { id, - ext_wire_expr: WireExprType::null(), + ext_wire_expr, }), }, res.expr(), @@ -412,6 +420,14 @@ pub(super) fn undeclare_client_subscription( let face = &mut client_subs[0]; if !(face.whatami == WhatAmI::Client && res.expr().starts_with(PREFIX_LIVELINESS)) { if let Some(id) = face_hat_mut!(face).local_subs.remove(res) { + // Still send WireExpr in UndeclareSubscriber to clients for pico + let ext_wire_expr = if face.whatami == WhatAmI::Client { + WireExprType { + wire_expr: Resource::get_best_key(res, "", face.id), + } + } else { + WireExprType::null() + }; face.primitives.send_declare(RoutingContext::with_expr( Declare { ext_qos: ext::QoSType::DECLARE, @@ -419,7 +435,7 @@ pub(super) fn undeclare_client_subscription( ext_nodeid: ext::NodeIdType::DEFAULT, body: DeclareBody::UndeclareSubscriber(UndeclareSubscriber { id, - ext_wire_expr: WireExprType::null(), + ext_wire_expr, }), }, res.expr(), diff --git a/zenoh/src/net/routing/hat/linkstate_peer/queries.rs b/zenoh/src/net/routing/hat/linkstate_peer/queries.rs index d7f42120f0..6703769a4b 100644 --- a/zenoh/src/net/routing/hat/linkstate_peer/queries.rs +++ b/zenoh/src/net/routing/hat/linkstate_peer/queries.rs @@ -365,15 +365,20 @@ fn send_forget_sourced_queryable_to_net_childs( fn propagate_forget_simple_queryable(tables: &mut Tables, res: &mut Arc) { for face in tables.faces.values_mut() { if let Some((id, _)) = face_hat_mut!(face).local_qabls.remove(res) { + // Still send WireExpr in UndeclareQueryable to clients for pico + let ext_wire_expr = if face.whatami == WhatAmI::Client { + WireExprType { + wire_expr: Resource::get_best_key(res, "", face.id), + } + } else { + WireExprType::null() + }; face.primitives.send_declare(RoutingContext::with_expr( Declare { ext_qos: ext::QoSType::DECLARE, ext_tstamp: None, ext_nodeid: ext::NodeIdType::DEFAULT, - body: DeclareBody::UndeclareQueryable(UndeclareQueryable { - id, - ext_wire_expr: WireExprType::null(), - }), + body: DeclareBody::UndeclareQueryable(UndeclareQueryable { id, ext_wire_expr }), }, res.expr(), )); @@ -478,6 +483,14 @@ pub(super) fn undeclare_client_queryable( if client_qabls.len() == 1 && !peer_qabls { let face = &mut client_qabls[0]; if let Some((id, _)) = face_hat_mut!(face).local_qabls.remove(res) { + // Still send WireExpr in UndeclareQueryable to clients for pico + let ext_wire_expr = if face.whatami == WhatAmI::Client { + WireExprType { + wire_expr: Resource::get_best_key(res, "", face.id), + } + } else { + WireExprType::null() + }; face.primitives.send_declare(RoutingContext::with_expr( Declare { ext_qos: ext::QoSType::DECLARE, @@ -485,7 +498,7 @@ pub(super) fn undeclare_client_queryable( ext_nodeid: ext::NodeIdType::DEFAULT, body: DeclareBody::UndeclareQueryable(UndeclareQueryable { id, - ext_wire_expr: WireExprType::null(), + ext_wire_expr, }), }, res.expr(), diff --git a/zenoh/src/net/routing/hat/p2p_peer/pubsub.rs b/zenoh/src/net/routing/hat/p2p_peer/pubsub.rs index 976466af12..22bd50eb3f 100644 --- a/zenoh/src/net/routing/hat/p2p_peer/pubsub.rs +++ b/zenoh/src/net/routing/hat/p2p_peer/pubsub.rs @@ -167,6 +167,14 @@ fn client_subs(res: &Arc) -> Vec> { fn propagate_forget_simple_subscription(tables: &mut Tables, res: &Arc) { for face in tables.faces.values_mut() { if let Some(id) = face_hat_mut!(face).local_subs.remove(res) { + // Still send WireExpr in UndeclareSubscriber to clients for pico + let ext_wire_expr = if face.whatami == WhatAmI::Client { + WireExprType { + wire_expr: Resource::get_best_key(res, "", face.id), + } + } else { + WireExprType::null() + }; face.primitives.send_declare(RoutingContext::with_expr( Declare { ext_qos: ext::QoSType::DECLARE, @@ -174,7 +182,7 @@ fn propagate_forget_simple_subscription(tables: &mut Tables, res: &Arc ext_nodeid: ext::NodeIdType::DEFAULT, body: DeclareBody::UndeclareSubscriber(UndeclareSubscriber { id, - ext_wire_expr: WireExprType::null(), + ext_wire_expr, }), }, res.expr(), @@ -201,6 +209,14 @@ pub(super) fn undeclare_client_subscription( let face = &mut client_subs[0]; if !(face.whatami == WhatAmI::Client && res.expr().starts_with(PREFIX_LIVELINESS)) { if let Some(id) = face_hat_mut!(face).local_subs.remove(res) { + // Still send WireExpr in UndeclareSubscriber to clients for pico + let ext_wire_expr = if face.whatami == WhatAmI::Client { + WireExprType { + wire_expr: Resource::get_best_key(res, "", face.id), + } + } else { + WireExprType::null() + }; face.primitives.send_declare(RoutingContext::with_expr( Declare { ext_qos: ext::QoSType::DECLARE, @@ -208,7 +224,7 @@ pub(super) fn undeclare_client_subscription( ext_nodeid: ext::NodeIdType::DEFAULT, body: DeclareBody::UndeclareSubscriber(UndeclareSubscriber { id, - ext_wire_expr: WireExprType::null(), + ext_wire_expr, }), }, res.expr(), diff --git a/zenoh/src/net/routing/hat/p2p_peer/queries.rs b/zenoh/src/net/routing/hat/p2p_peer/queries.rs index d8d0a3fcc0..76c3675dca 100644 --- a/zenoh/src/net/routing/hat/p2p_peer/queries.rs +++ b/zenoh/src/net/routing/hat/p2p_peer/queries.rs @@ -164,15 +164,20 @@ fn client_qabls(res: &Arc) -> Vec> { fn propagate_forget_simple_queryable(tables: &mut Tables, res: &mut Arc) { for face in tables.faces.values_mut() { if let Some((id, _)) = face_hat_mut!(face).local_qabls.remove(res) { + // Still send WireExpr in UndeclareQueryable to clients for pico + let ext_wire_expr = if face.whatami == WhatAmI::Client { + WireExprType { + wire_expr: Resource::get_best_key(res, "", face.id), + } + } else { + WireExprType::null() + }; face.primitives.send_declare(RoutingContext::with_expr( Declare { ext_qos: ext::QoSType::DECLARE, ext_tstamp: None, ext_nodeid: ext::NodeIdType::DEFAULT, - body: DeclareBody::UndeclareQueryable(UndeclareQueryable { - id, - ext_wire_expr: WireExprType::null(), - }), + body: DeclareBody::UndeclareQueryable(UndeclareQueryable { id, ext_wire_expr }), }, res.expr(), )); @@ -203,6 +208,14 @@ pub(super) fn undeclare_client_queryable( if client_qabls.len() == 1 { let face = &mut client_qabls[0]; if let Some((id, _)) = face_hat_mut!(face).local_qabls.remove(res) { + // Still send WireExpr in UndeclareQueryable to clients for pico + let ext_wire_expr = if face.whatami == WhatAmI::Client { + WireExprType { + wire_expr: Resource::get_best_key(res, "", face.id), + } + } else { + WireExprType::null() + }; face.primitives.send_declare(RoutingContext::with_expr( Declare { ext_qos: ext::QoSType::DECLARE, @@ -210,7 +223,7 @@ pub(super) fn undeclare_client_queryable( ext_nodeid: ext::NodeIdType::DEFAULT, body: DeclareBody::UndeclareQueryable(UndeclareQueryable { id, - ext_wire_expr: WireExprType::null(), + ext_wire_expr, }), }, res.expr(), diff --git a/zenoh/src/net/routing/hat/router/pubsub.rs b/zenoh/src/net/routing/hat/router/pubsub.rs index 2e7b22894d..e349fc7df9 100644 --- a/zenoh/src/net/routing/hat/router/pubsub.rs +++ b/zenoh/src/net/routing/hat/router/pubsub.rs @@ -404,6 +404,14 @@ fn send_forget_sourced_subscription_to_net_childs( fn propagate_forget_simple_subscription(tables: &mut Tables, res: &Arc) { for face in tables.faces.values_mut() { if let Some(id) = face_hat_mut!(face).local_subs.remove(res) { + // Still send WireExpr in UndeclareSubscriber to clients for pico + let ext_wire_expr = if face.whatami == WhatAmI::Client { + WireExprType { + wire_expr: Resource::get_best_key(res, "", face.id), + } + } else { + WireExprType::null() + }; face.primitives.send_declare(RoutingContext::with_expr( Declare { ext_qos: ext::QoSType::DECLARE, @@ -411,7 +419,7 @@ fn propagate_forget_simple_subscription(tables: &mut Tables, res: &Arc ext_nodeid: ext::NodeIdType::DEFAULT, body: DeclareBody::UndeclareSubscriber(UndeclareSubscriber { id, - ext_wire_expr: WireExprType::null(), + ext_wire_expr, }), }, res.expr(), @@ -429,6 +437,14 @@ fn propagate_forget_simple_subscription(tables: &mut Tables, res: &Arc .contains(&tables.zid) }) { if let Some(id) = face_hat_mut!(face).local_subs.remove(&res) { + // Still send WireExpr in UndeclareSubscriber to clients for pico + let ext_wire_expr = if face.whatami == WhatAmI::Client { + WireExprType { + wire_expr: Resource::get_best_key(&res, "", face.id), + } + } else { + WireExprType::null() + }; face.primitives.send_declare(RoutingContext::with_expr( Declare { ext_qos: ext::QoSType::DECLARE, @@ -436,7 +452,7 @@ fn propagate_forget_simple_subscription(tables: &mut Tables, res: &Arc ext_nodeid: ext::NodeIdType::DEFAULT, body: DeclareBody::UndeclareSubscriber(UndeclareSubscriber { id, - ext_wire_expr: WireExprType::null(), + ext_wire_expr, }), }, res.expr(), @@ -469,6 +485,14 @@ fn propagate_forget_simple_subscription_to_peers(tables: &mut Tables, res: &Arc< }) { if let Some(id) = face_hat_mut!(&mut face).local_subs.remove(res) { + // Still send WireExpr in UndeclareSubscriber to clients for pico + let ext_wire_expr = if face.whatami == WhatAmI::Client { + WireExprType { + wire_expr: Resource::get_best_key(res, "", face.id), + } + } else { + WireExprType::null() + }; face.primitives.send_declare(RoutingContext::with_expr( Declare { ext_qos: ext::QoSType::DECLARE, @@ -476,7 +500,7 @@ fn propagate_forget_simple_subscription_to_peers(tables: &mut Tables, res: &Arc< ext_nodeid: ext::NodeIdType::DEFAULT, body: DeclareBody::UndeclareSubscriber(UndeclareSubscriber { id, - ext_wire_expr: WireExprType::null(), + ext_wire_expr, }), }, res.expr(), @@ -620,6 +644,14 @@ pub(super) fn undeclare_client_subscription( let face = &mut client_subs[0]; if !(face.whatami == WhatAmI::Client && res.expr().starts_with(PREFIX_LIVELINESS)) { if let Some(id) = face_hat_mut!(face).local_subs.remove(res) { + // Still send WireExpr in UndeclareSubscriber to clients for pico + let ext_wire_expr = if face.whatami == WhatAmI::Client { + WireExprType { + wire_expr: Resource::get_best_key(res, "", face.id), + } + } else { + WireExprType::null() + }; face.primitives.send_declare(RoutingContext::with_expr( Declare { ext_qos: ext::QoSType::DECLARE, @@ -627,7 +659,7 @@ pub(super) fn undeclare_client_subscription( ext_nodeid: ext::NodeIdType::DEFAULT, body: DeclareBody::UndeclareSubscriber(UndeclareSubscriber { id, - ext_wire_expr: WireExprType::null(), + ext_wire_expr, }), }, res.expr(), @@ -810,16 +842,21 @@ pub(super) fn pubsub_linkstate_change(tables: &mut Tables, zid: &ZenohId, links: }) }; if forget { + // Still send WireExpr in UndeclareSubscriber to clients for pico + let ext_wire_expr = if dst_face.whatami == WhatAmI::Client { + WireExprType { + wire_expr: Resource::get_best_key(res, "", dst_face.id), + } + } else { + WireExprType::null() + }; dst_face.primitives.send_declare(RoutingContext::with_expr( Declare { ext_qos: ext::QoSType::DECLARE, ext_tstamp: None, ext_nodeid: ext::NodeIdType::DEFAULT, body: DeclareBody::UndeclareSubscriber( - UndeclareSubscriber { - id, - ext_wire_expr: WireExprType::null(), - }, + UndeclareSubscriber { id, ext_wire_expr }, ), }, res.expr(), diff --git a/zenoh/src/net/routing/hat/router/queries.rs b/zenoh/src/net/routing/hat/router/queries.rs index ddf8ef2226..8f87dc055f 100644 --- a/zenoh/src/net/routing/hat/router/queries.rs +++ b/zenoh/src/net/routing/hat/router/queries.rs @@ -507,15 +507,20 @@ fn send_forget_sourced_queryable_to_net_childs( fn propagate_forget_simple_queryable(tables: &mut Tables, res: &mut Arc) { for face in tables.faces.values_mut() { if let Some((id, _)) = face_hat_mut!(face).local_qabls.remove(res) { + // Still send WireExpr in UndeclareQueryable to clients for pico + let ext_wire_expr = if face.whatami == WhatAmI::Client { + WireExprType { + wire_expr: Resource::get_best_key(res, "", face.id), + } + } else { + WireExprType::null() + }; face.primitives.send_declare(RoutingContext::with_expr( Declare { ext_qos: ext::QoSType::DECLARE, ext_tstamp: None, ext_nodeid: ext::NodeIdType::DEFAULT, - body: DeclareBody::UndeclareQueryable(UndeclareQueryable { - id, - ext_wire_expr: WireExprType::null(), - }), + body: DeclareBody::UndeclareQueryable(UndeclareQueryable { id, ext_wire_expr }), }, res.expr(), )); @@ -533,6 +538,14 @@ fn propagate_forget_simple_queryable(tables: &mut Tables, res: &mut Arc