Skip to content

Commit

Permalink
Adapting session throughput binaries to new reliability and congestio…
Browse files Browse the repository at this point in the history
…n control
  • Loading branch information
Mallets committed Sep 8, 2020
1 parent 869d8e8 commit e11ae20
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 32 deletions.
5 changes: 3 additions & 2 deletions zenoh-perf/src/bin/router_thr_pub_client.rs
Expand Up @@ -38,8 +38,9 @@ fn main() {
env_logger::init();

// Initialize the Peer Id
let mut pid = vec![0, 0, 0, 0];
let mut pid = [0u8; PeerId::MAX_SIZE];
rand::thread_rng().fill_bytes(&mut pid);
let pid = PeerId::new(1, pid);

let mut args = std::env::args();
// Get exe name
Expand Down Expand Up @@ -69,7 +70,7 @@ fn main() {
let config = SessionManagerConfig {
version: 0,
whatami: whatami::CLIENT,
id: PeerId { id: pid },
id: pid,
handler: broker.clone(),
};
let manager = SessionManager::new(config, None);
Expand Down
5 changes: 3 additions & 2 deletions zenoh-perf/src/bin/router_thr_pub_light_client.rs
Expand Up @@ -65,8 +65,9 @@ fn main() {
env_logger::init();

// Initialize the Peer Id
let mut pid = vec![0, 0, 0, 0];
let mut pid = [0u8; PeerId::MAX_SIZE];
rand::thread_rng().fill_bytes(&mut pid);
let pid = PeerId::new(1, pid);

let mut args = std::env::args();
// Get exe name
Expand Down Expand Up @@ -106,7 +107,7 @@ fn main() {
let config = SessionManagerConfig {
version: 0,
whatami: whatami::CLIENT,
id: PeerId { id: pid.clone() },
id: pid,
handler: session_handler.clone(),
};
let manager = SessionManager::new(config, None);
Expand Down
5 changes: 3 additions & 2 deletions zenoh-perf/src/bin/router_thr_pub_peer.rs
Expand Up @@ -38,8 +38,9 @@ fn main() {
env_logger::init();

// Initialize the Peer Id
let mut pid = vec![0, 0, 0, 0];
let mut pid = [0u8; PeerId::MAX_SIZE];
rand::thread_rng().fill_bytes(&mut pid);
let pid = PeerId::new(1, pid);

let mut args = std::env::args();
// Get exe name
Expand Down Expand Up @@ -69,7 +70,7 @@ fn main() {
let config = SessionManagerConfig {
version: 0,
whatami: whatami::PEER,
id: PeerId { id: pid },
id: pid,
handler: broker.clone(),
};
let manager = SessionManager::new(config, None);
Expand Down
5 changes: 3 additions & 2 deletions zenoh-perf/src/bin/router_thr_sub_client.rs
Expand Up @@ -127,8 +127,9 @@ fn main() {
env_logger::init();

// Initialize the Peer Id
let mut pid = vec![0, 0, 0, 0];
let mut pid = [0u8; PeerId::MAX_SIZE];
rand::thread_rng().fill_bytes(&mut pid);
let pid = PeerId::new(1, pid);

let mut args = std::env::args();
// Get exe name
Expand All @@ -146,7 +147,7 @@ fn main() {
let config = SessionManagerConfig {
version: 0,
whatami: whatami::CLIENT,
id: PeerId { id: pid },
id: pid,
handler: broker.clone(),
};
let manager = SessionManager::new(config, None);
Expand Down
5 changes: 3 additions & 2 deletions zenoh-perf/src/bin/router_thr_sub_light_client.rs
Expand Up @@ -151,8 +151,9 @@ fn main() {
env_logger::init();

// Initialize the Peer Id
let mut pid = vec![0, 0, 0, 0];
let mut pid = [0u8; PeerId::MAX_SIZE];
rand::thread_rng().fill_bytes(&mut pid);
let pid = PeerId::new(1, pid);

let mut args = std::env::args();
// Get exe name
Expand Down Expand Up @@ -180,7 +181,7 @@ fn main() {
let config = SessionManagerConfig {
version: 0,
whatami: whatami::CLIENT,
id: PeerId { id: pid.clone() },
id: pid,
handler: session_handler.clone(),
};
let manager = SessionManager::new(config, None);
Expand Down
5 changes: 3 additions & 2 deletions zenoh-perf/src/bin/router_thr_sub_peer.rs
Expand Up @@ -128,8 +128,9 @@ fn main() {
env_logger::init();

// Initialize the Peer Id
let mut pid = vec![0, 0, 0, 0];
let mut pid = [0u8; PeerId::MAX_SIZE];
rand::thread_rng().fill_bytes(&mut pid);
let pid = PeerId::new(1, pid);

let mut args = std::env::args();
// Get exe name
Expand Down Expand Up @@ -159,7 +160,7 @@ fn main() {
let config = SessionManagerConfig {
version: 0,
whatami: whatami::PEER,
id: PeerId { id: pid },
id: pid,
handler: broker.clone(),
};
let manager = SessionManager::new(config, None);
Expand Down
5 changes: 3 additions & 2 deletions zenoh-perf/src/bin/session_thr_pub_client.rs
Expand Up @@ -58,8 +58,9 @@ fn main() {
env_logger::init();

// Initialize the Peer Id
let mut pid = vec![0, 0, 0, 0];
let mut pid = [0u8; PeerId::MAX_SIZE];
rand::thread_rng().fill_bytes(&mut pid);
let pid = PeerId::new(1, pid);

let mut args = std::env::args();
// Get exe name
Expand Down Expand Up @@ -98,7 +99,7 @@ fn main() {
let config = SessionManagerConfig {
version: 0,
whatami: whatami::PEER,
id: PeerId { id: pid },
id: pid,
handler: Arc::new(MySH::new()),
};
let manager = SessionManager::new(config, None);
Expand Down
21 changes: 15 additions & 6 deletions zenoh-perf/src/bin/session_thr_pub_peer.rs
Expand Up @@ -16,7 +16,7 @@ use async_std::task;
use async_trait::async_trait;
use rand::RngCore;

use zenoh_protocol::core::{whatami, PeerId, ResKey};
use zenoh_protocol::core::{whatami, CongestionControl, PeerId, Reliability, ResKey};
use zenoh_protocol::io::RBuf;
use zenoh_protocol::link::Locator;
use zenoh_protocol::proto::ZenohMessage;
Expand Down Expand Up @@ -59,8 +59,9 @@ fn main() {
env_logger::init();

// Initialize the Peer Id
let mut pid = vec![0, 0, 0, 0];
let mut pid = [0u8; PeerId::MAX_SIZE];
rand::thread_rng().fill_bytes(&mut pid);
let pid = PeerId::new(1, pid);

let mut args = std::env::args();
// Get exe name
Expand Down Expand Up @@ -99,7 +100,7 @@ fn main() {
let config = SessionManagerConfig {
version: 0,
whatami: whatami::PEER,
id: PeerId { id: pid },
id: pid,
handler: Arc::new(MySH::new()),
};
let manager = SessionManager::new(config, None);
Expand All @@ -120,14 +121,22 @@ fn main() {
};

// Send reliable messages
let reliable = true;
let reliability = Reliability::Reliable;
let congestion_control = CongestionControl::Block;
let key = ResKey::RName("test".to_string());
let info = None;
let payload = RBuf::from(vec![0u8; payload]);
let reply_context = None;

let message =
ZenohMessage::make_data(reliable, key, info, payload, reply_context, attachment);
let message = ZenohMessage::make_data(
key,
payload,
reliability,
congestion_control,
info,
reply_context,
attachment,
);

loop {
let res = session.handle_message(message.clone()).await;
Expand Down
5 changes: 3 additions & 2 deletions zenoh-perf/src/bin/session_thr_pubsub_client.rs
Expand Up @@ -95,8 +95,9 @@ Example:
}

fn main() {
let mut pid: Vec<u8> = vec![0, 0, 0, 0, 0, 0, 0, 0];
let mut pid = [0u8; PeerId::MAX_SIZE];
rand::thread_rng().fill_bytes(&mut pid);
let pid = PeerId::new(1, pid);

let count = Arc::new(AtomicUsize::new(0));

Expand Down Expand Up @@ -137,7 +138,7 @@ fn main() {
let config = SessionManagerConfig {
version: 0,
whatami: whatami::PEER,
id: PeerId { id: pid },
id: pid,
handler: Arc::new(MySH::new(count)),
};
let manager = SessionManager::new(config, None);
Expand Down
5 changes: 3 additions & 2 deletions zenoh-perf/src/bin/session_thr_pubsub_peer.rs
Expand Up @@ -99,8 +99,9 @@ fn main() {
env_logger::init();

// Initialize the Peer Id
let mut pid = vec![0, 0, 0, 0];
let mut pid = [0u8; PeerId::MAX_SIZE];
rand::thread_rng().fill_bytes(&mut pid);
let pid = PeerId::new(1, pid);

let count = Arc::new(AtomicUsize::new(0));

Expand Down Expand Up @@ -153,7 +154,7 @@ fn main() {
let config = SessionManagerConfig {
version: 0,
whatami: whatami::PEER,
id: PeerId { id: pid },
id: pid,
handler: Arc::new(MySH::new(count)),
};
let manager = SessionManager::new(config, None);
Expand Down
Expand Up @@ -96,8 +96,9 @@ fn main() {
env_logger::init();

// Initialize the Peer Id
let mut pid = vec![0, 0, 0, 0];
let mut pid = [0u8; PeerId::MAX_SIZE];
rand::thread_rng().fill_bytes(&mut pid);
let pid = PeerId::new(1, pid);

let mut args = std::env::args();
// Get exe name
Expand Down Expand Up @@ -125,7 +126,7 @@ fn main() {
let config = SessionManagerConfig {
version: 0,
whatami: whatami::PEER,
id: PeerId { id: pid },
id: pid,
handler: Arc::new(MySH::new()),
};
let manager = SessionManager::new(config, None);
Expand Down
4 changes: 2 additions & 2 deletions zenoh-perf/src/bin/session_thr_sink_tcp.rs
Expand Up @@ -29,9 +29,9 @@ async fn handle_client(
) -> Result<(), Box<dyn std::error::Error>> {
let counter = Arc::new(AtomicUsize::new(0));

let mut apid = vec![0, 0, 0, 0];
let mut apid = [0u8; PeerId::MAX_SIZE];
rand::thread_rng().fill_bytes(&mut apid);
let apid = PeerId { id: apid };
let apid = PeerId::new(1, pid);

let mut buffer = vec![0u8; bs];

Expand Down
5 changes: 3 additions & 2 deletions zenoh-perf/src/bin/session_thr_sub_client.rs
Expand Up @@ -101,15 +101,16 @@ fn main() {
env_logger::init();

// Initialize the Peer Id
let mut pid = vec![0, 0, 0, 0];
let mut pid = [0u8; PeerId::MAX_SIZE];
rand::thread_rng().fill_bytes(&mut pid);
let pid = PeerId::new(1, pid);

let count = Arc::new(AtomicUsize::new(0));

let config = SessionManagerConfig {
version: 0,
whatami: whatami::PEER,
id: PeerId { id: pid },
id: pid,
handler: Arc::new(MySH::new(count)),
};
let manager = SessionManager::new(config, None);
Expand Down
5 changes: 3 additions & 2 deletions zenoh-perf/src/bin/session_thr_sub_peer.rs
Expand Up @@ -100,15 +100,16 @@ fn main() {
env_logger::init();

// Initialize the Peer Id
let mut pid = vec![0, 0, 0, 0];
let mut pid = [0u8; PeerId::MAX_SIZE];
rand::thread_rng().fill_bytes(&mut pid);
let pid = PeerId::new(1, pid);

let count = Arc::new(AtomicUsize::new(0));

let config = SessionManagerConfig {
version: 0,
whatami: whatami::PEER,
id: PeerId { id: pid },
id: pid,
handler: Arc::new(MySH::new(count)),
};
let manager = SessionManager::new(config, None);
Expand Down

0 comments on commit e11ae20

Please sign in to comment.