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

Method shutdown_all

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

Sends shutdown signals to all io tasks. This function sequentially sends `ControlRequest::Shutdown` signals to all io tasks and then waits for all io tasks to exit.

(&mut self)

Source from the content-addressed store, hash-verified

347 /// This function sequentially sends `ControlRequest::Shutdown` signals to all
348 /// io tasks and then waits for all io tasks to exit.
349 pub async fn shutdown_all(&mut self) {
350 info!("Starting shutdown of SourceIO components.");
351 // Shutdown link local source
352 if let Some(Source {
353 state: _,
354 ctrl_sender,
355 }) = &mut self.link_local
356 {
357 match ctrl_sender.send(ControlRequest::Shutdown).await {
358 Ok(()) => info!("Successfully sent shutdown signal to link local source."),
359 Err(e) => warn!(?e, "Failed to send shutdown signal to link local source."),
360 }
361 }
362
363 // Shutdown PHC source
364 if let Some(Source {
365 state: _,
366 ctrl_sender,
367 }) = &mut self.phc
368 {
369 match ctrl_sender.send(ControlRequest::Shutdown).await {
370 Ok(()) => info!("Successfully sent shutdown signal to phc source."),
371 Err(e) => warn!(?e, "Failed to send shutdown signal to phc source."),
372 }
373 }
374
375 // Shutdown vmclock source
376 if let Some(Source {
377 state: _,
378 ctrl_sender,
379 }) = &mut self.vmclock
380 {
381 match ctrl_sender.send(ControlRequest::Shutdown).await {
382 Ok(()) => info!("Successfully sent shutdown signal to vmclock source."),
383 Err(e) => warn!(?e, "Failed to send shutdown signal to vmclock source."),
384 }
385 }
386
387 // Shutdown ntp sources
388 for ntp_source in self.ntp_sources.values_mut() {
389 match ntp_source.ctrl_sender.send(ControlRequest::Shutdown).await {
390 Ok(()) => info!("Successfully sent shutdown signal to ntp source."),
391 Err(e) => warn!(?e, "Failed to send shutdown signal to ntp source."),
392 }
393 }
394
395 // Wait for all io tasks to exit
396 info!("Waiting for {} io tasks to exit.", self.task_tracker.len());
397 self.task_tracker.wait().await;
398 info!("All tasks exited. Shutdown of io complete.");
399 }
400}
401
402/// Communication channels for sending and receiving clock disruption events.

Callers

nothing calls this directly

Calls 1

sendMethod · 0.80

Tested by

no test coverage detected