Accept commands 30s in the future
This commit is contained in:
parent
0b5ab4872c
commit
cc0d2fb3f0
17
src/lib.rs
17
src/lib.rs
@ -43,17 +43,14 @@ impl ProxyCommand {
|
|||||||
let now = time::SystemTime::now()
|
let now = time::SystemTime::now()
|
||||||
.duration_since(time::UNIX_EPOCH)
|
.duration_since(time::UNIX_EPOCH)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
if now > timestamp {
|
if timestamp > (now + time::Duration::from_secs(30)) {
|
||||||
// timestamp is older
|
tracing::warn!("command is more than 30s from the future");
|
||||||
if now - timestamp <= time::Duration::from_secs(60) {
|
false
|
||||||
// less than a minute old
|
} else if now - timestamp <= time::Duration::from_secs(60) {
|
||||||
true
|
// less than a minute old
|
||||||
} else {
|
true
|
||||||
tracing::warn!("command is more than a minute old");
|
|
||||||
false
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
tracing::warn!("command is from the future");
|
tracing::warn!("command is more than a minute old");
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user