|
|
@@ -58,7 +58,8 @@ pub mod report_table;
|
|
|
|
|
|
#[cfg(feature = "bridgeauth")]
|
|
|
use bridge_table::{
|
|
|
- from_scalar, BridgeLine, BridgeTable, EncryptedBucket, MAX_BRIDGES_PER_BUCKET, MIN_BUCKET_REACHABILITY,
|
|
|
+ from_scalar, BridgeLine, BridgeTable, EncryptedBucket, MAX_BRIDGES_PER_BUCKET,
|
|
|
+ MIN_BUCKET_REACHABILITY,
|
|
|
};
|
|
|
#[cfg(feature = "bridgeauth")]
|
|
|
use lox_creds::*;
|
|
|
@@ -661,9 +662,7 @@ impl BridgeAuth {
|
|
|
.iter()
|
|
|
.position(|x| x == bridge)
|
|
|
{
|
|
|
- Some(index) => Some({
|
|
|
- self.bridge_table.unallocated_bridges.swap_remove(index)
|
|
|
- }),
|
|
|
+ Some(index) => Some({ self.bridge_table.unallocated_bridges.swap_remove(index) }),
|
|
|
None => None,
|
|
|
}
|
|
|
}
|
|
|
@@ -976,8 +975,18 @@ impl BridgeAuth {
|
|
|
|
|
|
/// Process the report of a scan to determine whether a bridge was
|
|
|
/// blocked or not
|
|
|
- pub fn process_scan_result(&mut self, bridge_hashed_fingerprint: [u8; 20], cc: CountryCode, status: ReportStatus, bdb: &mut BridgeDb) {
|
|
|
- if let Some(bucket) = self.report_table.process_scan_result_and_return_bucket(&bridge_hashed_fingerprint, cc, status) {
|
|
|
+ pub fn process_scan_result(
|
|
|
+ &mut self,
|
|
|
+ bridge_hashed_fingerprint: [u8; 20],
|
|
|
+ cc: CountryCode,
|
|
|
+ status: ReportStatus,
|
|
|
+ bdb: &mut BridgeDb,
|
|
|
+ ) {
|
|
|
+ if let Some(bucket) = self.report_table.process_scan_result_and_return_bucket(
|
|
|
+ &bridge_hashed_fingerprint,
|
|
|
+ cc,
|
|
|
+ status,
|
|
|
+ ) {
|
|
|
if status == ReportStatus::Blocked {
|
|
|
// Mark the bridge as blocked
|
|
|
|
|
|
@@ -987,7 +996,9 @@ impl BridgeAuth {
|
|
|
|
|
|
let (id, _key) = match from_scalar(bucket) {
|
|
|
Ok((id, key)) => (id, key),
|
|
|
- Err(_) => {return;},
|
|
|
+ Err(_) => {
|
|
|
+ return;
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
let mut bridge_to_block = None;
|
|
|
@@ -1022,7 +1033,11 @@ impl BridgeAuth {
|
|
|
cc: CountryCode,
|
|
|
current_time: SystemTime,
|
|
|
) {
|
|
|
- self.report_table.mark_old_reports_simulated_time(bridge_hashed_fingerprint, cc, current_time);
|
|
|
+ self.report_table.mark_old_reports_simulated_time(
|
|
|
+ bridge_hashed_fingerprint,
|
|
|
+ cc,
|
|
|
+ current_time,
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
|