commit 122ad409aa0dd84563d580e5002cecb1cc20d25f Author: Isis Lovecruft isis@torproject.org Date: Fri Dec 5 18:55:14 2014 -0800
Update the Bridge's transports in updateFromExtraInfoDescriptor(). --- lib/bridgedb/bridges.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
diff --git a/lib/bridgedb/bridges.py b/lib/bridgedb/bridges.py index d2e528d..fede979 100644 --- a/lib/bridgedb/bridges.py +++ b/lib/bridgedb/bridges.py @@ -1295,3 +1295,34 @@ class Bridge(object): return
self.descriptors['extrainfo'] = descriptor + + updatedTransports = [] + + for transport in self.transports: + for methodname, kitchenSink in descriptor.transport: + if transport.methodname == methodname: + if transport.address == kitchenSink[0]: + logging.info( + "Updating %s pluggable transport for bridge %s." % + (methodname, safelog.logSafely(self.fingerprint))) + updatedTransports.append(transport) + transport.updateFromStemTransport(self.fingerprint, + methodname, + kitchenSink) + else: + logging.info( + ("Received new %s pluggable transport for bridge " + "%s.") % + (methodname, safelog.logSafely(self.fingerprint))) + pt = PluggableTransport() + pt.updateFromStemTransport(self.fingerprint, + methodname, + kitchenSink) + updatedTransports.append(pt) + self.transports.append(pt) + + dead = set(self.transports).difference(set(updatedTransports)) + logging.info("The following transports for bridge %s died: %s" + % (self, ' '.join(dead))) + for died in dead: + self.transports.remove(died)
tor-commits@lists.torproject.org