Constructs a new `SourceIO` object and constructs the necessary resources.
(selected_clock: Arc<SelectedClockSource>, daemon_info: DaemonInfo)
| 61 | clock_disruption_channels: ClockDisruptionChannels, |
| 62 | /// Shared reference to the current selected clock source |
| 63 | selected_clock: Arc<SelectedClockSource>, |
| 64 | /// Daemon metadata |
| 65 | daemon_info: DaemonInfo, |
| 66 | /// `tokio::task::TaskTracker` to manage lifecycle of the individual IO tasks |
| 67 | task_tracker: TaskTracker, |
| 68 | /// DNS message sender |
| 69 | /// |
| 70 | /// Passed into resolver structs to construct and delete NTP sources |
| 71 | dns_message_tx: mpsc::Sender<daemon::DnsMessage>, |
| 72 | /// Shared tracker of IP addresses currently in use by NTP IO tasks |
| 73 | in_use_ip_addrs: InUseIpAddrs, |
| 74 | } |
| 75 | |
| 76 | impl SourceIO { |
| 77 | /// Constructs a new `SourceIO` object and constructs the necessary resources. |
| 78 | pub fn construct( |
| 79 | selected_clock: Arc<SelectedClockSource>, |
| 80 | daemon_info: DaemonInfo, |
| 81 | dns_message_tx: mpsc::Sender<daemon::DnsMessage>, |
| 82 | ) -> Self { |
| 83 | let (sender, _) = watch::channel::<ClockDisruptionEvent>(ClockDisruptionEvent::default()); |
| 84 | |
| 85 | // Task tracker is closed on initialization. We only open it during calls to spawn |
| 86 | // the IO tasks. This ensures that we don't introduce a deadlock if the shutdown function |