Selaa lähdekoodia

Actually track whether user can connect each day

Vecna 7 kuukautta sitten
vanhempi
commit
4f66b01ed3
1 muutettua tiedostoa jossa 6 lisäystä ja 0 poistoa
  1. 6 0
      src/user.rs

+ 6 - 0
src/user.rs

@@ -384,6 +384,10 @@ impl User {
     ) -> Result<Vec<User>> {
         // Probabilistically decide if the user should use bridges today
         if event_happens(self.prob_use_bridges) {
+            // Start with the assumption that we can't connect, change
+            // only if we can
+            self.able_to_connect = false;
+
             // Download bucket to see if bridge is still reachable. (We
             // assume that this step can be done even if the user can't
             // actually talk to the LA.)
@@ -438,6 +442,7 @@ impl User {
                             .unwrap(),
                         &censor,
                     ) {
+                        self.able_to_connect = true;
                         succeeded.push(bucket[i]);
                     } else {
                         failed.push(bucket[i]);
@@ -485,6 +490,7 @@ impl User {
 
                         // Attempt to connect to second cred's bridge
                         if Self::connect(self.in_censorship_range, &config, bridge, censor) {
+                            self.able_to_connect = true;
                             succeeded.push(bridgeline);
                             if second_reachcred.is_some()
                                 && eligible_for_trust_promotion(&config.la_net, &second_cred).await