[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [onionoo/master] Clarify some code in DescriptorQueue.
commit b72b27184cb16cba48d9d1f46f000020a0341869
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Thu Jun 29 15:13:54 2017 +0200
Clarify some code in DescriptorQueue.
Suggested by iwakeh on #22681.
---
.../org/torproject/onionoo/updater/DescriptorQueue.java | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/torproject/onionoo/updater/DescriptorQueue.java b/src/main/java/org/torproject/onionoo/updater/DescriptorQueue.java
index ae68b41..48fb4bf 100644
--- a/src/main/java/org/torproject/onionoo/updater/DescriptorQueue.java
+++ b/src/main/java/org/torproject/onionoo/updater/DescriptorQueue.java
@@ -129,6 +129,8 @@ class DescriptorQueue {
}
}
+ /** Returns the next parseable Descriptor, or null if there are no further
+ * parseable Descriptors available. */
public Descriptor nextDescriptor() {
Descriptor nextDescriptor = null;
if (null == this.descriptors) {
@@ -143,14 +145,13 @@ class DescriptorQueue {
return null;
}
}
- while (null == nextDescriptor && this.descriptors.hasNext()) {
+ while (this.descriptors.hasNext()) {
nextDescriptor = this.descriptors.next();
- if (nextDescriptor instanceof UnparseableDescriptor) {
- nextDescriptor = null;
- continue;
+ if (!(nextDescriptor instanceof UnparseableDescriptor)) {
+ this.returnedDescriptors++;
+ this.returnedBytes += nextDescriptor.getRawDescriptorLength();
+ break;
}
- this.returnedDescriptors++;
- this.returnedBytes += nextDescriptor.getRawDescriptorLength();
}
return nextDescriptor;
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits