pass message from daemon to CLI
This commit is contained in:
parent
64b65d7ecd
commit
cc027d2cc1
10
src/data.rs
10
src/data.rs
@ -661,6 +661,11 @@ impl BrainData {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if let Err(e) = update_vm_req.1.send(update_vm_resp.clone()) {
|
||||||
|
log::warn!(
|
||||||
|
"CLI RX dropped before receiving UpdateVMResp {update_vm_resp:?}. Error: {e:?}"
|
||||||
|
);
|
||||||
|
}
|
||||||
if update_vm_resp.error != "" {
|
if update_vm_resp.error != "" {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -697,11 +702,6 @@ impl BrainData {
|
|||||||
update_vm_resp.error = "VM Contract not found.".to_string();
|
update_vm_resp.error = "VM Contract not found.".to_string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Err(e) = update_vm_req.1.send(update_vm_resp.clone()) {
|
|
||||||
log::warn!(
|
|
||||||
"CLI RX dropped before receiving UpdateVMResp {update_vm_resp:?}. Error: {e:?}"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn submit_newvm_req(
|
pub async fn submit_newvm_req(
|
||||||
|
@ -475,9 +475,9 @@ fn check_sig_from_req<T: std::fmt::Debug + PubkeyGetter>(req: Request<T>) -> Res
|
|||||||
let parsed_time = chrono::DateTime::parse_from_rfc3339(time)
|
let parsed_time = chrono::DateTime::parse_from_rfc3339(time)
|
||||||
.map_err(|_| Status::unauthenticated("Coult not parse timestamp"))?;
|
.map_err(|_| Status::unauthenticated("Coult not parse timestamp"))?;
|
||||||
let seconds_elapsed = now.signed_duration_since(parsed_time).num_seconds();
|
let seconds_elapsed = now.signed_duration_since(parsed_time).num_seconds();
|
||||||
if seconds_elapsed > 1 || seconds_elapsed < -1 {
|
if seconds_elapsed > 4 || seconds_elapsed < -4 {
|
||||||
return Err(Status::unauthenticated(format!(
|
return Err(Status::unauthenticated(format!(
|
||||||
"Date is not within 1 sec of the time of the server: CLI {} vs Server {}",
|
"Date is not within 4 sec of the time of the server: CLI {} vs Server {}",
|
||||||
parsed_time, now
|
parsed_time, now
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
@ -530,9 +530,9 @@ fn check_sig_from_parts(pubkey: &str, time: &str, msg: &str, sig: &str) -> Resul
|
|||||||
let parsed_time = chrono::DateTime::parse_from_rfc3339(time)
|
let parsed_time = chrono::DateTime::parse_from_rfc3339(time)
|
||||||
.map_err(|_| Status::unauthenticated("Coult not parse timestamp"))?;
|
.map_err(|_| Status::unauthenticated("Coult not parse timestamp"))?;
|
||||||
let seconds_elapsed = now.signed_duration_since(parsed_time).num_seconds();
|
let seconds_elapsed = now.signed_duration_since(parsed_time).num_seconds();
|
||||||
if seconds_elapsed > 1 || seconds_elapsed < -1 {
|
if seconds_elapsed > 4 || seconds_elapsed < -4 {
|
||||||
return Err(Status::unauthenticated(format!(
|
return Err(Status::unauthenticated(format!(
|
||||||
"Date is not within 1 sec of the time of the server: CLI {} vs Server {}",
|
"Date is not within 4 sec of the time of the server: CLI {} vs Server {}",
|
||||||
parsed_time, now
|
parsed_time, now
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user