Handle errors sending positive reports
This commit is contained in:
parent
84d431e21a
commit
135d2c6b02
|
@ -126,22 +126,22 @@ impl Censor {
|
||||||
}
|
}
|
||||||
|
|
||||||
let (cred, _) = &self.lox_credentials.get(fingerprint).unwrap();
|
let (cred, _) = &self.lox_credentials.get(fingerprint).unwrap();
|
||||||
let pr = PositiveReport::from_lox_credential(
|
if let Ok(pr) = PositiveReport::from_lox_credential(
|
||||||
*fingerprint,
|
*fingerprint,
|
||||||
None,
|
None,
|
||||||
cred,
|
cred,
|
||||||
get_lox_pub(&config.la_pubkeys),
|
get_lox_pub(&config.la_pubkeys),
|
||||||
config.country.clone(),
|
config.country.clone(),
|
||||||
)
|
) {
|
||||||
.unwrap();
|
if config
|
||||||
if config
|
.tp_net
|
||||||
.tp_net
|
.request("/positivereport".to_string(), pr.to_json().into_bytes())
|
||||||
.request("/positivereport".to_string(), pr.to_json().into_bytes())
|
.await
|
||||||
.await
|
.is_err()
|
||||||
.is_err()
|
{
|
||||||
{
|
// failed to send positive report
|
||||||
// failed to send positive report
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
23
src/user.rs
23
src/user.rs
|
@ -589,16 +589,15 @@ impl User {
|
||||||
bridge.first_positive_report = get_date();
|
bridge.first_positive_report = get_date();
|
||||||
}
|
}
|
||||||
|
|
||||||
positive_reports.push(
|
if let Ok(pr) = PositiveReport::from_lox_credential(
|
||||||
PositiveReport::from_lox_credential(
|
fingerprint,
|
||||||
fingerprint,
|
None,
|
||||||
None,
|
&self.primary_cred,
|
||||||
&self.primary_cred,
|
get_lox_pub(&config.la_pubkeys),
|
||||||
get_lox_pub(&config.la_pubkeys),
|
config.country.to_string(),
|
||||||
config.country.to_string(),
|
) {
|
||||||
)
|
positive_reports.push(pr)
|
||||||
.unwrap(),
|
}
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -628,7 +627,7 @@ impl User {
|
||||||
level_up(
|
level_up(
|
||||||
&config.la_net,
|
&config.la_net,
|
||||||
&self.primary_cred,
|
&self.primary_cred,
|
||||||
&reachcred.unwrap(),
|
&reachcred.unwrap(), // must be Some
|
||||||
get_lox_pub(&config.la_pubkeys),
|
get_lox_pub(&config.la_pubkeys),
|
||||||
get_reachability_pub(&config.la_pubkeys),
|
get_reachability_pub(&config.la_pubkeys),
|
||||||
)
|
)
|
||||||
|
@ -806,7 +805,7 @@ impl User {
|
||||||
level_up(
|
level_up(
|
||||||
&config.la_net,
|
&config.la_net,
|
||||||
&self.primary_cred,
|
&self.primary_cred,
|
||||||
&reachcred.unwrap(),
|
&reachcred.unwrap(), // must be Some
|
||||||
get_lox_pub(&config.la_pubkeys),
|
get_lox_pub(&config.la_pubkeys),
|
||||||
get_reachability_pub(&config.la_pubkeys),
|
get_reachability_pub(&config.la_pubkeys),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue