Commit 0bc21e19 authored by Matthew Finkel's avatar Matthew Finkel Committed by George Kadianakis
Browse files

More bridge pool assignment debug output

Also more readable descriptor parser debug logging
parent 78ba1628
Loading
Loading
Loading
Loading
+5 −0
Changes for lib/bridgedb/Bridges.py: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -553,6 +553,8 @@ def parseStatusFile(f):
    num_or_address_lines = 0
    or_addresses = {}
    for line in f:
        if not ID:
            logging.debug("Parsing network status line")
        line = line.strip()
        if line.startswith("opt "):
            line = line[4:]
@@ -563,6 +565,7 @@ def parseStatusFile(f):
                timestamp = time.mktime(time.strptime(
                    " ".join(line.split()[4:6]), "%Y-%m-%d %H:%M:%S")
                    )
                logging.debug("  Fingerprint: %s", toHex(ID))
                logging.debug("  Timestamp: %s", timestamp)
            except binascii.Error:
                logging.warn("  Unparseable base64 ID %r", line.split()[2])
@@ -1026,6 +1029,8 @@ class FilteredBridgeSplitter(BridgeHolder):
                        desc.append(g.description)

            # add transports
            logging.debug("%s supports %d transports" % (toHex(b.getID()),
                                                         len(b.transports)))
            for transport in b.transports:
                desc.append("transport=%s"%(transport.methodname))

+3 −0
Changes for lib/bridgedb/Main.py: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -232,8 +232,10 @@ def load(cfg, splitter, clear=False):
        for transport in Bridges.parseExtraInfoFile(f):
            ID, method_name, address, port, argdict = transport
            if bridges[ID].running:
                logging.debug("  Appending transport to running bridge")
                bridges[ID].transports.append(Bridges.PluggableTransport(bridges[ID],
                    method_name, address, port, argdict))
                assert bridges[ID].transports, "We added a transport but it disappeared!"
        logging.debug("Closing extra-info document")
        f.close()
    if hasattr(cfg, "COUNTRY_BLOCK_FILE"):
@@ -417,6 +419,7 @@ def startup(cfg):

        # Dump bridge pool assignments to disk.
        try:
            logging.debug("Dumping pool assignments file")
            f = open(cfg.ASSIGNMENTS_FILE, 'a')
            f.write("bridge-pool-assignment %s\n" %
                    time.strftime("%Y-%m-%d %H:%M:%S"))