MCPcopy Create free account
hub / github.com/aws/clock-bound / create_link_local

Method create_link_local

clock-bound/src/daemon/io.rs:90–118  ·  view source on GitHub ↗

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>)

Source from the content-addressed store, hash-verified

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 ///

Callers 3

constructMethod · 0.80
setupFunction · 0.80

Calls 1

InitializedClass · 0.85

Tested by

no test coverage detected