| 216 | } |
| 217 | |
| 218 | fn handle_event(&mut self, routable_event: RoutableEvent) { |
| 219 | if let Some(params) = self.clock_sync_algorithm.feed(routable_event) { |
| 220 | use crate::daemon::async_ring_buffer::SendError; |
| 221 | |
| 222 | match self.clock_state_handle.tx.send(params.clone()) { |
| 223 | Ok(()) => (), |
| 224 | Err(SendError::Disrupted(clock_parameters)) => { |
| 225 | // don't handle_disruption. It will be handled on the next call of tokio::select |
| 226 | info!( |
| 227 | ?clock_parameters, |
| 228 | "Trying to send a value when there was a disruption event. dropping." |
| 229 | ); |
| 230 | } |
| 231 | Err(SendError::BufferClosed(e)) => { |
| 232 | error!( |
| 233 | ?e, |
| 234 | "Trying to send a value when the buffer is closed. Panicking." |
| 235 | ); |
| 236 | panic!("Unable to communicate with clock state. {e:?}"); |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | /// Handle a clock disruption event |
| 243 | fn handle_disruption(&mut self) { |