From 94de239c00cad50f7f21553652bb2f2ef0a5d013 Mon Sep 17 00:00:00 2001 From: Luca Cominardi Date: Wed, 7 Feb 2024 12:37:16 +0100 Subject: [PATCH] Fix shared-memory feature --- io/zenoh-transport/src/shm.rs | 17 +++++++++-------- zenoh/src/net/routing/dispatcher/queries.rs | 4 +++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/io/zenoh-transport/src/shm.rs b/io/zenoh-transport/src/shm.rs index 04a8f502c4..8b0e93f494 100644 --- a/io/zenoh-transport/src/shm.rs +++ b/io/zenoh-transport/src/shm.rs @@ -21,6 +21,7 @@ use zenoh_protocol::{ err::{ext::ErrBodyType, Err}, ext::ShmType, query::{ext::QueryBodyType, Query}, + reply::ReplyBody, PushBody, Put, Reply, RequestBody, ResponseBody, }, }; @@ -105,17 +106,17 @@ impl MapShm for Query { // Impl - Reply impl MapShm for Reply { fn map_to_shminfo(&mut self) -> ZResult { - let Self { - payload, ext_shm, .. - } = self; - map_to_shminfo!(payload, ext_shm) + match &mut self.payload { + ReplyBody::Put(b) => b.map_to_shminfo(), + _ => Ok(false), + } } fn map_to_shmbuf(&mut self, shmr: &RwLock) -> ZResult { - let Self { - payload, ext_shm, .. - } = self; - map_to_shmbuf!(payload, ext_shm, shmr) + match &mut self.payload { + ReplyBody::Put(b) => b.map_to_shmbuf(shmr), + _ => Ok(false), + } } } diff --git a/zenoh/src/net/routing/dispatcher/queries.rs b/zenoh/src/net/routing/dispatcher/queries.rs index ec85dbee43..ebba01fa47 100644 --- a/zenoh/src/net/routing/dispatcher/queries.rs +++ b/zenoh/src/net/routing/dispatcher/queries.rs @@ -545,7 +545,9 @@ pub fn route_query( encoding: Encoding::default(), // @TODO: handle encoding ext_sinfo: None, // @TODO: handle source info ext_attachment: None, // @TODO: expose it in the API - ext_unknown: vec![], // @TODO: handle unknown extensions + #[cfg(feature = "shared-memory")] + ext_shm: None, + ext_unknown: vec![], // @TODO: handle unknown extensions payload, }), });