[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [onionoo/master] Fix trivial bug in parsing bridge extra-info descriptors.
commit ba53eddc3735191ec8b11a3178c3cb0190460c3e
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Tue Aug 21 12:03:45 2018 +0200
Fix trivial bug in parsing bridge extra-info descriptors.
If the first thing we'd learn from a bridge was an extra-info
descriptor, we would not have stored the contained transports. This
case is very unlikely and has very little effect. Worth fixing anyway.
Found via code analysis.
---
.../onionoo/updater/NodeDetailsStatusUpdater.java | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java b/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java
index 7223e5a..1cd989d 100644
--- a/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java
+++ b/src/main/java/org/torproject/onionoo/updater/NodeDetailsStatusUpdater.java
@@ -346,14 +346,16 @@ public class NodeDetailsStatusUpdater implements DescriptorListener,
DetailsStatus.class, true, fingerprint);
if (detailsStatus == null) {
detailsStatus = new DetailsStatus();
- } else if (null == detailsStatus.getExtraInfoDescPublished()
- || descriptor.getPublishedMillis()
- > detailsStatus.getExtraInfoDescPublished()) {
- detailsStatus.setExtraInfoDescPublished(
- descriptor.getPublishedMillis());
- detailsStatus.setTransports(descriptor.getTransports());
- this.documentStore.store(detailsStatus, fingerprint);
+ } else if (null != detailsStatus.getExtraInfoDescPublished()
+ && detailsStatus.getExtraInfoDescPublished()
+ >= descriptor.getPublishedMillis()) {
+ /* Already parsed more recent extra-info descriptor from this bridge. */
+ return;
}
+ detailsStatus.setExtraInfoDescPublished(
+ descriptor.getPublishedMillis());
+ detailsStatus.setTransports(descriptor.getTransports());
+ this.documentStore.store(detailsStatus, fingerprint);
}
private void processBridgeNetworkStatus(BridgeNetworkStatus status) {
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits