Expose client and multiclient config
This commit is contained in:
parent
a527b22515
commit
b62afb32e6
2 changed files with 15 additions and 3 deletions
|
|
@ -199,6 +199,10 @@ impl MultiClient {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn config(&self) -> &MultiClientConfig {
|
||||||
|
&self.config
|
||||||
|
}
|
||||||
|
|
||||||
pub fn start_time(&self) -> Timestamp {
|
pub fn start_time(&self) -> Timestamp {
|
||||||
self.start_time
|
self.start_time
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use std::{fmt, result, str::FromStr};
|
use std::{fmt, result, str::FromStr, sync::Arc};
|
||||||
|
|
||||||
use cookie::Cookie;
|
use cookie::Cookie;
|
||||||
use euphoxide::{
|
use euphoxide::{
|
||||||
|
|
@ -120,7 +120,7 @@ impl ClientEvent {
|
||||||
|
|
||||||
struct ClientTask {
|
struct ClientTask {
|
||||||
id: usize,
|
id: usize,
|
||||||
config: ClientConfig,
|
config: Arc<ClientConfig>,
|
||||||
|
|
||||||
cmd_rx: mpsc::Receiver<Command>,
|
cmd_rx: mpsc::Receiver<Command>,
|
||||||
event_tx: mpsc::Sender<ClientEvent>,
|
event_tx: mpsc::Sender<ClientEvent>,
|
||||||
|
|
@ -337,6 +337,7 @@ impl ClientTask {
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
id: usize,
|
id: usize,
|
||||||
|
config: Arc<ClientConfig>,
|
||||||
cmd_tx: mpsc::Sender<Command>,
|
cmd_tx: mpsc::Sender<Command>,
|
||||||
start_time: Timestamp,
|
start_time: Timestamp,
|
||||||
}
|
}
|
||||||
|
|
@ -353,11 +354,13 @@ impl Client {
|
||||||
pub fn new(id: usize, config: ClientConfig, event_tx: mpsc::Sender<ClientEvent>) -> Self {
|
pub fn new(id: usize, config: ClientConfig, event_tx: mpsc::Sender<ClientEvent>) -> Self {
|
||||||
let start_time = Timestamp::now();
|
let start_time = Timestamp::now();
|
||||||
|
|
||||||
|
let config = Arc::new(config);
|
||||||
|
|
||||||
let (cmd_tx, cmd_rx) = mpsc::channel(config.server.cmd_channel_bufsize);
|
let (cmd_tx, cmd_rx) = mpsc::channel(config.server.cmd_channel_bufsize);
|
||||||
|
|
||||||
let task = ClientTask {
|
let task = ClientTask {
|
||||||
id,
|
id,
|
||||||
config,
|
config: config.clone(),
|
||||||
attempts: 0,
|
attempts: 0,
|
||||||
never_joined: false,
|
never_joined: false,
|
||||||
cmd_rx,
|
cmd_rx,
|
||||||
|
|
@ -368,6 +371,7 @@ impl Client {
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
id,
|
id,
|
||||||
|
config,
|
||||||
cmd_tx,
|
cmd_tx,
|
||||||
start_time,
|
start_time,
|
||||||
}
|
}
|
||||||
|
|
@ -377,6 +381,10 @@ impl Client {
|
||||||
self.id
|
self.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn config(&self) -> &ClientConfig {
|
||||||
|
&self.config
|
||||||
|
}
|
||||||
|
|
||||||
pub fn start_time(&self) -> Timestamp {
|
pub fn start_time(&self) -> Timestamp {
|
||||||
self.start_time
|
self.start_time
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue