summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-09-14 22:07:59 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-09-14 22:07:59 +0800
commitc02e74bea833224e2ff35c6da51ff30119d7b924 (patch)
tree5b5e6a2c95eb7c628486a4a1356e0c326f23927c
parent6cefc22e34e5fe0bdc5d8f8c959860a3fc08342b (diff)
chore(httpconnector): better naming and qualification
-rw-r--r--src/client/connector/connectors/httpconnector.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/client/connector/connectors/httpconnector.rs b/src/client/connector/connectors/httpconnector.rs
index f3d9ef9..8f06074 100644
--- a/src/client/connector/connectors/httpconnector.rs
+++ b/src/client/connector/connectors/httpconnector.rs
@@ -1,14 +1,13 @@
+use crate::{connector::Connection, executor::Executor};
+use remote_control_rs::tasks::TASKS;
use reqwest::{
Error, StatusCode, Url,
blocking::{Client, RequestBuilder},
};
-
-use crate::connector::*;
-use remote_control_rs::tasks::TASKS;
-use std::{thread::sleep, time::Duration};
+use std::{net::IpAddr, thread::sleep, time::Duration};
pub struct HTTPConnector {
- network_updater: Executor,
+ network_enforcer: Executor,
pull_url: Url,
ntfy_url: Url,
ip_getter_url: Url,
@@ -25,7 +24,7 @@ impl HTTPConnector {
// TODO: proper type
assert_eq!(TASKS[2].name, "network");
Ok(Self {
- network_updater: Executor::new(&TASKS[2], ["on".to_string()]).unwrap(),
+ network_enforcer: Executor::new(&TASKS[2], ["on".to_string()]).unwrap(), // .unwrap() should never panic
prev: String::new(),
pull_url: Url::parse(pull_url)?,
ntfy_url: Url::parse(ntfy_url)?,
@@ -103,7 +102,7 @@ impl Connection for HTTPConnector {
}
fn force_network(&mut self) {
- _ = self.network_updater.run();
+ _ = self.network_enforcer.run();
}
fn get_ip(&self) -> Option<IpAddr> {