aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorIntegral <[email protected]>2024-12-07 17:54:53 +0800
committerGitHub <[email protected]>2024-12-07 17:54:53 +0800
commit772db7422f679db1fa06be1097cd676a73055851 (patch)
treed2247269277b27b20f34372d93eb1a778e95721b /src
parent2f246537df8dff36a2facc60bfdd429ed065272c (diff)
downloadrustdesk-server-772db7422f679db1fa06be1097cd676a73055851.tar.gz
rustdesk-server-772db7422f679db1fa06be1097cd676a73055851.zip
refactor: replace static with const for global constants (#494)HEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/peer.rs8
-rw-r--r--src/rendezvous_server.rs2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/peer.rs b/src/peer.rs
index c3bf76c..4ca87cf 100644
--- a/src/peer.rs
+++ b/src/peer.rs
@@ -18,10 +18,10 @@ lazy_static::lazy_static! {
pub(crate) static ref USER_STATUS: RwLock<UserStatusMap> = Default::default();
pub(crate) static ref IP_CHANGES: Mutex<IpChangesMap> = Default::default();
}
-pub static IP_CHANGE_DUR: u64 = 180;
-pub static IP_CHANGE_DUR_X2: u64 = IP_CHANGE_DUR * 2;
-pub static DAY_SECONDS: u64 = 3600 * 24;
-pub static IP_BLOCK_DUR: u64 = 60;
+pub const IP_CHANGE_DUR: u64 = 180;
+pub const IP_CHANGE_DUR_X2: u64 = IP_CHANGE_DUR * 2;
+pub const DAY_SECONDS: u64 = 3600 * 24;
+pub const IP_BLOCK_DUR: u64 = 60;
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
pub(crate) struct PeerInfo {
diff --git a/src/rendezvous_server.rs b/src/rendezvous_server.rs
index 9394731..65c8022 100644
--- a/src/rendezvous_server.rs
+++ b/src/rendezvous_server.rs
@@ -58,7 +58,7 @@ type Sender = mpsc::UnboundedSender<Data>;
type Receiver = mpsc::UnboundedReceiver<Data>;
static ROTATION_RELAY_SERVER: AtomicUsize = AtomicUsize::new(0);
type RelayServers = Vec<String>;
-static CHECK_RELAY_TIMEOUT: u64 = 3_000;
+const CHECK_RELAY_TIMEOUT: u64 = 3_000;
static ALWAYS_USE_RELAY: AtomicBool = AtomicBool::new(false);
#[derive(Clone)]