[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/master] 5482 - Parse descriptors to glean bridge stability information.



commit 73440e363ffe018ff02dced7478a01a995f591ce
Author: aagbsn <aagbsn@xxxxxxxx>
Date:   Tue Oct 23 07:45:50 2012 -0700

    5482 - Parse descriptors to glean bridge stability information.
---
 lib/bridgedb/Main.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/lib/bridgedb/Main.py b/lib/bridgedb/Main.py
index 31c9917..56a52dd 100644
--- a/lib/bridgedb/Main.py
+++ b/lib/bridgedb/Main.py
@@ -174,9 +174,10 @@ def load(cfg, splitter, clear=False):
             #transports[ID] = transports
         f.close()
     bridges = {} 
+    db = bridgedb.Storage.getDB()
     for fname in cfg.BRIDGE_FILES:
         f = open(fname, 'r')
-        for bridge in Bridges.parseDescFile(f, cfg.BRIDGE_PURPOSE):
+        for bridge, timestamp in Bridges.parseDescFile(f, cfg.BRIDGE_PURPOSE):
             bridges[bridge.getID()] = bridge
             s = status.get(bridge.getID())
             if s is not None:
@@ -184,6 +185,11 @@ def load(cfg, splitter, clear=False):
                 bridge.setStatus(running=running, stable=stable)
             bridge.or_addresses = addresses.get(bridge.getID())
             splitter.insert(bridge)
+            # add or update BridgeHistory entries into the database
+            # XXX: what do we do with all these or_addresses?
+            # The bridge stability metrics are only concerned with a single ip:port
+            # So for now, we will only consider the bridges primary IP:port
+            bridgedb.Stability.addOrUpdateBridgeHistory(bridge, timestamp)
         f.close()
     # read pluggable transports from extra-info document
     # XXX: should read from networkstatus after bridge-authority



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits