Skip to content

Commit

Permalink
Indicate, that Nurse does not need Tx side of libtelio_event_publisher
Browse files Browse the repository at this point in the history
Nurse only needs to listen to libtelio events. To indicate that in a
strong-typed manner, update NurseIo to receive Receiver instead of
sender side and doing subscribtion inside.
  • Loading branch information
Jauler committed Dec 9, 2024
1 parent c60eede commit 3f9a3e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions crates/telio-nurse/src/nurse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ use crate::qos::Io as QoSIo;
use crate::qos::OutputData as QoSData;

/// Input/output channels for Nurse
pub struct NurseIo<'a> {
pub struct NurseIo {
/// Event channel to gather wg events
pub wg_event_channel: &'a mc_chan::Tx<Box<Event>>,
pub wg_event_channel: mc_chan::Rx<Box<Event>>,
/// Event channel to gather wg data
pub wg_analytics_channel: Option<mc_chan::Tx<Box<AnalyticsEvent>>>,
/// Event channel to gather meshnet config update
Expand All @@ -57,7 +57,7 @@ impl Nurse {
pub async fn start_with(
public_key: PublicKey,
config: Config,
io: NurseIo<'_>,
io: NurseIo,
aggregator: Arc<ConnectivityDataAggregator>,
ipv6_enabled: bool,
) -> Self {
Expand Down Expand Up @@ -127,7 +127,7 @@ impl State {
pub async fn new(
public_key: PublicKey,
config: Config,
io: NurseIo<'_>,
io: NurseIo,
aggregator: Arc<ConnectivityDataAggregator>,
ipv6_enabled: bool,
) -> Self {
Expand All @@ -152,7 +152,7 @@ impl State {
let heartbeat_io = HeartbeatIo {
chan: None,
derp_event_channel: None,
wg_event_channel: io.wg_event_channel.subscribe(),
wg_event_channel: io.wg_event_channel,
config_update_channel: config_update_channel.subscribe(),
analytics_channel: analytics_channel.tx.clone(),
collection_trigger_channel: collection_trigger_channel.subscribe(),
Expand Down
2 changes: 1 addition & 1 deletion src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ impl Runtime {
let nurse = if telio_lana::is_lana_initialized() {
if let Some(nurse_features) = &features.nurse {
let nurse_io = NurseIo {
wg_event_channel: &libtelio_wide_event_publisher,
wg_event_channel: libtelio_wide_event_publisher.subscribe(),
wg_analytics_channel: analytics_ch.clone(),
config_update_channel: config_update_ch.clone(),
collection_trigger_channel: collection_trigger_ch.clone(),
Expand Down

0 comments on commit 3f9a3e2

Please sign in to comment.