Implement network manager simulator lifecycle (#53)
All checks were successful
Native code generation / deterministic (push) Successful in 8m55s
Imaging and meshing gate / native (push) Successful in 2m45s
JPEG 2000 feature / linux (push) Successful in 1m41s
Native Rust workspace compile / compile (push) Successful in 1m57s
Skia feature / linux (push) Successful in 31m12s
All checks were successful
Native code generation / deterministic (push) Successful in 8m55s
Imaging and meshing gate / native (push) Successful in 2m45s
JPEG 2000 feature / linux (push) Successful in 1m41s
Native Rust workspace compile / compile (push) Successful in 1m57s
Skia feature / linux (push) Successful in 31m12s
This commit is contained in:
@@ -223,12 +223,23 @@ impl ClientRuntime {
|
||||
/// Construction is side-effect free: it creates no runtime, task, socket, or
|
||||
/// HTTP request. Network-facing services are attached explicitly and are owned
|
||||
/// until ordered shutdown or drop.
|
||||
#[derive(Clone)]
|
||||
pub struct GridClient {
|
||||
pub(crate) settings: Settings,
|
||||
pub(crate) time_provider: TimeProvider,
|
||||
runtime: Arc<ClientRuntime>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) struct ClientRetentionProbe(std::sync::Weak<ClientRuntime>);
|
||||
|
||||
#[cfg(test)]
|
||||
impl ClientRetentionProbe {
|
||||
pub(crate) fn is_released(&self) -> bool {
|
||||
self.0.upgrade().is_none()
|
||||
}
|
||||
}
|
||||
|
||||
impl GridClient {
|
||||
#[must_use]
|
||||
pub fn builder() -> GridClientBuilder {
|
||||
@@ -301,6 +312,11 @@ impl GridClient {
|
||||
pub(crate) fn shutdown(&self) -> Result<(), ClientCoreError> {
|
||||
self.runtime.shutdown()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn retention_probe(&self) -> ClientRetentionProbe {
|
||||
ClientRetentionProbe(Arc::downgrade(&self.runtime))
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for GridClient {
|
||||
@@ -325,7 +341,9 @@ impl fmt::Debug for GridClient {
|
||||
|
||||
impl Drop for GridClient {
|
||||
fn drop(&mut self) {
|
||||
let _ = self.runtime.shutdown();
|
||||
if Arc::strong_count(&self.runtime) == 1 {
|
||||
let _ = self.runtime.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,6 +450,11 @@ impl Settings {
|
||||
}
|
||||
}
|
||||
|
||||
/// Mutable access to the mapped agent settings for native composition.
|
||||
pub fn agent_settings_mut(&mut self) -> &mut AgentSettings {
|
||||
&mut self.agent
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn connection_mut(&mut self) -> &mut ConnectionSettings {
|
||||
&mut self.connection
|
||||
|
||||
Reference in New Issue
Block a user