Commit 5080bf99 authored by Karsten Loesing's avatar Karsten Loesing
Browse files

Replace if with switch.

parent 00eb709d
Loading
Loading
Loading
Loading
+22 −15
Original line number Diff line number Diff line
@@ -812,21 +812,28 @@ public class RelayDescriptorDownloader {
                  this.downloadResourceFromAuthority(authority,
                  combinedResource.toString());
            }
            if (type.equals("server")) {
            switch (type) {
              case "server":
                this.requestedMissingServerDescriptors +=
                    requestedDescriptors;
                this.downloadedMissingServerDescriptors +=
                    downloadedDescriptors;
            } else if (type.equals("extra")) {
                break;
              case "extra":
                this.requestedMissingExtraInfoDescriptors +=
                    requestedDescriptors;
                this.downloadedMissingExtraInfoDescriptors +=
                    downloadedDescriptors;
            } else if (type.equals("micro")) {
                break;
              case "micro":
                this.requestedMissingMicrodescriptors +=
                    requestedDescriptors;
                this.downloadedMissingMicrodescriptors +=
                    downloadedDescriptors;
                break;
              default:
                /* Unknown type, nothing to do. */
                break;
            }
          }
        }
+55 −51
Original line number Diff line number Diff line
@@ -175,7 +175,8 @@ public class RelayDescriptorParser {
            }
          }
        }
        if (statusType.equals("consensus")) {
        switch (statusType) {
          case "consensus":
            if (this.rdd != null) {
              this.rdd.haveParsedConsensus(validAfterTime, dirSources,
                  serverDescriptors);
@@ -185,7 +186,8 @@ public class RelayDescriptorParser {
                  serverDescriptorDigests);
              stored = true;
            }
        } else if (statusType.equals("consensus-microdesc")) {
            break;
          case "consensus-microdesc":
            if (this.rdd != null) {
              this.rdd.haveParsedMicrodescConsensus(validAfterTime,
                  microdescriptorKeys);
@@ -199,7 +201,8 @@ public class RelayDescriptorParser {
                  microdescriptorDigests);
              stored = true;
            }
        } else {
            break;
          default:
            if (this.aw != null || this.rdd != null) {
              String ascii = new String(data, "US-ASCII");
              String startToken = "network-status-version ";
@@ -229,6 +232,7 @@ public class RelayDescriptorParser {
                }
              }
            }
            break;
        }
      } else if (line.startsWith("router ")) {
        String publishedTime = null;