Initializes the IO task for sampling the Link Local NTP source. # Panics - If not called within the `tokio` runtime. - If socket binding fails.
(&mut self, event_sender: async_ring_buffer::Sender<event::Ntp>)
| 88 | /// - If not called within the `tokio` runtime. |
| 89 | /// - If socket binding fails. |
| 90 | pub async fn create_link_local(&mut self, event_sender: async_ring_buffer::Sender<event::Ntp>) { |
| 91 | info!("Creating link local source."); |
| 92 | |
| 93 | debug!(?self.link_local, "Current source entry status"); |
| 94 | if self.link_local.is_none() { |
| 95 | self.link_local = { |
| 96 | let (ctrl_sender, ctrl_receiver) = mpsc::channel::<ControlRequest>(1); |
| 97 | let clock_disruption_receiver = self.clock_disruption_channels.sender.subscribe(); |
| 98 | |
| 99 | let socket = UdpSocket::bind(ntp::UNSPECIFIED_SOCKET_ADDRESS) |
| 100 | .await |
| 101 | .unwrap(); |
| 102 | |
| 103 | let link_local = LinkLocal::construct( |
| 104 | socket, |
| 105 | event_sender, |
| 106 | ctrl_receiver, |
| 107 | clock_disruption_receiver, |
| 108 | self.selected_clock.clone(), |
| 109 | ); |
| 110 | Some(Source { |
| 111 | state: SourceState::Initialized(link_local), |
| 112 | ctrl_sender, |
| 113 | }) |
| 114 | }; |
| 115 | } |
| 116 | |
| 117 | info!("Source link local update complete."); |
| 118 | } |
| 119 | |
| 120 | /// Initializes the IO task for sampling a specific NTP Server source. |
| 121 | /// |
no test coverage detected