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

[tor-commits] [bridgedb/master] Fix scripts/gen_bridge_descriptors to create two cached-extrainfo files.



commit 0b64895b448d1dd1066696f79a65745897a10c4e
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Sat Oct 26 10:11:29 2013 +0000

    Fix scripts/gen_bridge_descriptors to create two cached-extrainfo files.
    
    We usually have 'cached-extrainfo' and 'cached-extrainfo.new', not
    'extra-infos'.
---
 scripts/gen_bridge_descriptors |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/scripts/gen_bridge_descriptors b/scripts/gen_bridge_descriptors
index e272600..c7ffcee 100644
--- a/scripts/gen_bridge_descriptors
+++ b/scripts/gen_bridge_descriptors
@@ -752,10 +752,19 @@ def create(count):
         code = 1515
     finally:
         print("Writing descriptors to files...", end="")
+
+        cached = "cached-extrainfo.new"
         descriptor_files = {
             "networkstatus-bridges": ''.join(netstatus_consensus),
             "bridge-descriptors": ''.join(server_descriptors),
-            "extra-infos": ''.join(extrainfo_descriptors)}
+            "cached-extrainfo.new": ''.join(extrainfo_descriptors)}
+
+        if not os.path.isfile(cached):
+            with open(cached, 'wb') as fh:
+                fh.flush()
+        if os.path.isfile(cached)
+            os.rename(cached, "cached-extrainfo")
+
         for fn, giantstring in descriptor_files.items():
             writeDescToFile(fn, giantstring)
         print("Done.")



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