[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Handling the server descriptor's hibernating line
commit da5fcc6ba9b170fce548f08848ae2b0b268bf547
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sun Mar 18 15:18:56 2012 -0700
Handling the server descriptor's hibernating line
---
stem/descriptor/server_descriptor.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py
index cee2bcd..4ba7acc 100644
--- a/stem/descriptor/server_descriptor.py
+++ b/stem/descriptor/server_descriptor.py
@@ -71,6 +71,7 @@ class ServerDescriptorV2(Descriptor):
tor_version (stem.version.Version) - version of tor
published (datetime.datetime) - time in GMT when the descriptor was generated (*)
fingerprint (str) - fourty hex digits that make up the relay's fingerprint
+ hibernating (bool) - flag to indicate if the relay was hibernating when published (*)
* required fields, others are left as None if undefined
"""
@@ -79,6 +80,7 @@ class ServerDescriptorV2(Descriptor):
average_bandwidth = burst_bandwidth = observed_bandwidth = None
platform = tor_version = None
published = fingerprint = None
+ hibernating = False
def __init__(self, contents):
Descriptor.__init__(self, contents)
@@ -207,4 +209,11 @@ class ServerDescriptorV2(Descriptor):
raise TypeError("Tor relay fingerprints consist of fourty hex digits: %s" % value)
self.fingerprint = fingerprint
+ elif keyword == "hibernating":
+ # "hibernating" 0|1 (in practice only set if one)
+
+ if not value in ("0", "1"):
+ raise TypeError("Hibernating line had an invalid value, must be zero or one: %s" % value)
+
+ self.hibernating = value == "1"
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits