Skip to content

Commit

Permalink
Msgs reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierHecart committed Jul 23, 2020
1 parent 8f43577 commit 44830e2
Show file tree
Hide file tree
Showing 9 changed files with 442 additions and 409 deletions.
10 changes: 5 additions & 5 deletions zenoh-protocol/src/proto/demux.rs
Expand Up @@ -13,7 +13,7 @@
//
use async_trait::async_trait;

use crate::proto::{ZenohMessage, ZenohBody, Declaration, Primitives, zmsg};
use crate::proto::{ZenohMessage, ZenohBody, Declare, Data, Query, Pull, Declaration, Primitives, zmsg};
use crate::session::MsgHandler;
use zenoh_util::zerror;
use zenoh_util::core::{ZResult, ZError, ZErrorKind};
Expand All @@ -34,7 +34,7 @@ impl<P: Primitives + Send + Sync> MsgHandler for DeMux<P> {
async fn handle_message(&self, msg: ZenohMessage) -> ZResult<()> {
let reliability = msg.is_reliable();
match msg.body {
ZenohBody::Declare{ declarations, .. } => {
ZenohBody::Declare(Declare{ declarations, .. }) => {
for declaration in declarations {
match declaration {
Declaration::Resource { rid, key } => {
Expand Down Expand Up @@ -66,7 +66,7 @@ impl<P: Primitives + Send + Sync> MsgHandler for DeMux<P> {
}
},

ZenohBody::Data { key, info, payload, .. } => {
ZenohBody::Data(Data{ key, info, payload, .. }) => {
match msg.reply_context {
None => {
self.primitives.data(&key, reliability, &info, payload).await;
Expand All @@ -90,11 +90,11 @@ impl<P: Primitives + Send + Sync> MsgHandler for DeMux<P> {
}
},

ZenohBody::Query{ key, predicate, qid, target, consolidation, .. } => {
ZenohBody::Query(Query{ key, predicate, qid, target, consolidation, .. }) => {
self.primitives.query(&key, &predicate, qid, target.unwrap_or_default(), consolidation).await;
},

ZenohBody::Pull{ key, pull_id, max_samples, .. } => {
ZenohBody::Pull(Pull{ key, pull_id, max_samples, .. }) => {
self.primitives.pull(zmsg::has_flag(msg.header, zmsg::flag::F), &key, pull_id, &max_samples).await;
}
}
Expand Down

0 comments on commit 44830e2

Please sign in to comment.