summaryrefslogtreecommitdiff
path: root/src/services/ping.rs
diff options
context:
space:
mode:
authorFxQnLr <[email protected]>2024-04-15 21:12:04 +0200
committerGitHub <[email protected]>2024-04-15 21:12:04 +0200
commitea4f36ea34a4e425ef23e2ae0d4ea210d4a8a145 (patch)
treed89f0da1841b984c10a6a24997a8733524b75f75 /src/services/ping.rs
parentb615f6e34e084d520dcc301058b5926074188500 (diff)
parent7876dd605a8e4b595436035a87a5151be187c01d (diff)
downloadwebol-ea4f36ea34a4e425ef23e2ae0d4ea210d4a8a145.tar
webol-ea4f36ea34a4e425ef23e2ae0d4ea210d4a8a145.tar.gz
webol-ea4f36ea34a4e425ef23e2ae0d4ea210d4a8a145.zip
Merge pull request #36 from FxQnLr/optional_ip
Optional ip and better docs
Diffstat (limited to 'src/services/ping.rs')
-rw-r--r--src/services/ping.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/services/ping.rs b/src/services/ping.rs
index 1bf022d..4e0ffcf 100644
--- a/src/services/ping.rs
+++ b/src/services/ping.rs
@@ -28,7 +28,9 @@ pub async fn spawn(
28 28
29 let mut msg: Option<BroadcastCommand> = None; 29 let mut msg: Option<BroadcastCommand> = None;
30 while msg.is_none() { 30 while msg.is_none() {
31 let ping = surge_ping::ping(device.ip.ip(), &payload).await; 31 // Safe: Only called when ip is set
32 let ip = device.ip.unwrap();
33 let ping = surge_ping::ping(ip.ip(), &payload).await;
32 34
33 if let Err(ping) = ping { 35 if let Err(ping) = ping {
34 let ping_timeout = matches!(ping, surge_ping::SurgeError::Timeout { .. }); 36 let ping_timeout = matches!(ping, surge_ping::SurgeError::Timeout { .. });