Skip to content

Commit 1c8d047

Browse files
Fix Davids comments
1 parent 4ff1c01 commit 1c8d047

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed

talpid-core/src/offline/windows.rs

+32
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,35 @@ fn apply_system_state_change(state: Arc<Mutex<SystemState>>, change: StateChange
208208
let mut state = state.lock();
209209
state.apply_change(change);
210210
}
211+
212+
struct ConnectivityInner {
213+
/// Whether IPv4 connectivity seems to be available on the host.
214+
ipv4: bool,
215+
/// Whether IPv6 connectivity seems to be available on the host.
216+
ipv6: bool,
217+
/// The host is suspended.
218+
suspended: bool,
219+
}
220+
221+
impl ConnectivityInner {
222+
/// Map [`ConnectivityInner`] to the public [`Connectivity`].
223+
///
224+
/// # Note
225+
///
226+
/// If the host is suspended, there is a great likelihood that we should
227+
/// consider the host to be offline. We synthesize this by setting both
228+
/// `ipv4` and `ipv6` availability to `false`.
229+
pub fn into_connectivity(&self) -> Connectivity {
230+
if self.suspended {
231+
Connectivity {
232+
ipv4: false,
233+
ipv6: false,
234+
}
235+
} else {
236+
Connectivity {
237+
ipv4: self.ipv4,
238+
ipv6: self.ipv6,
239+
}
240+
}
241+
}
242+
}

talpid-types/src/net/mod.rs

-9
Original file line numberDiff line numberDiff line change
@@ -534,15 +534,6 @@ pub enum Connectivity {
534534
/// On/offline status could not be verified, but we have no particular
535535
/// reason to believe that the host is offline.
536536
PresumeOnline,
537-
/// The host is suspended.
538-
///
539-
/// If the host is suspended, there is a great likelihood that we should
540-
/// consider the host to be offline.
541-
#[cfg(windows)]
542-
Suspended {
543-
last_known_ipv4: bool,
544-
last_known_ipv6: bool,
545-
},
546537
}
547538

548539
impl Connectivity {

0 commit comments

Comments
 (0)