Skip to content

Commit

Permalink
fix rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaeling committed Nov 28, 2024
1 parent c0a6260 commit 87d30b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
6 changes: 2 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,8 @@ async fn main() -> Result<()> {
Api::KuksaValV1
};

if let Some(_) = args.buffer_size {
if matches!(api, Api::SdvDatabrokerV1 | Api::KuksaValV1) {
println!("Warning: buffer_size will be ignored, only supported for kuksa.val.v2 API");
}
if args.buffer_size.is_some() && matches!(api, Api::SdvDatabrokerV1 | Api::KuksaValV1) {
println!("Warning: buffer_size will be ignored, only supported for kuksa.val.v2 API");
}

let config_groups = read_config(args.test_data_file.as_ref())?;
Expand Down
22 changes: 6 additions & 16 deletions src/measure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,9 @@ async fn create_subscriber(
initial_values_sender: Sender<HashMap<Signal, DataValue>>,
buffer_size: Option<u32>,
) -> Result<Subscriber> {
let subscriber_channel = endpoint.connect().await.with_context(|| {
let host = endpoint.uri().host().unwrap_or("unknown host");
let port = endpoint
.uri()
.port()
.map_or("unknown port".to_string(), |p| p.to_string());
format!("Failed to connect to server {}:{}", host, port)
})?;

if *api == Api::KuksaValV2 {
let subscriber = s_kuksa_val_v2::Subscriber::new(
subscriber_channel,
channel,
signals,
initial_values_sender,
buffer_size.unwrap_or(10),
Expand All @@ -133,17 +124,16 @@ async fn create_subscriber(
subscriber_interface: Box::new(subscriber),
})
} else if *api == Api::SdvDatabrokerV1 {
let subscriber = s_sdv_databroker_v1::Subscriber::new(subscriber_channel, signals)
let subscriber = s_sdv_databroker_v1::Subscriber::new(channel, signals)
.await
.unwrap();
Ok(Subscriber {
subscriber_interface: Box::new(subscriber),
})
} else {
let subscriber =
s_kuksa_val_v1::Subscriber::new(subscriber_channel, signals, initial_values_sender)
.await
.unwrap();
let subscriber = s_kuksa_val_v1::Subscriber::new(channel, signals, initial_values_sender)
.await
.unwrap();
Ok(Subscriber {
subscriber_interface: Box::new(subscriber),
})
Expand Down Expand Up @@ -258,7 +248,7 @@ pub async fn perform_measurement(
let subscriber_channel = subscriber_channel.clone();
let subscriber = create_subscriber(
subscriber_channel,
signals,
signals.clone(),
&measurement_config.api,
initial_values_sender,
measurement_config.buffer_size,
Expand Down

0 comments on commit 87d30b5

Please sign in to comment.