[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Treat descriptor archive contents as individual files
commit 6927e68d80bf78d898afe321a599bf174e116e40
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sat Feb 16 21:53:24 2013 -0800
Treat descriptor archive contents as individual files
When the descriptor reader encountered an archive and read non-descriptor
content it stopped reading. This has caused me almost two weeks of headaches in
troubleshooting...
https://trac.torproject.org/8049
Changing the reader's behaviour to instead handle each file within the archive
separately. Thanks to Karsten for catching this!
---
stem/descriptor/reader.py | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/stem/descriptor/reader.py b/stem/descriptor/reader.py
index b017e06..ffd0289 100644
--- a/stem/descriptor/reader.py
+++ b/stem/descriptor/reader.py
@@ -553,19 +553,20 @@ class DescriptorReader(object):
archive_path = entry.name
entry.name = target
- for desc in stem.descriptor.parse_file(entry, validate = self._validate, document_handler = self._document_handler):
- if self._is_stopped.isSet():
- return
-
- desc._set_archive_path(archive_path)
- self._unreturned_descriptors.put(desc)
- self._iter_notice.set()
-
- entry.close()
- except TypeError, exc:
- self._notify_skip_listeners(target, ParsingFailure(exc))
- except ValueError, exc:
- self._notify_skip_listeners(target, ParsingFailure(exc))
+ try:
+ for desc in stem.descriptor.parse_file(entry, validate = self._validate, document_handler = self._document_handler):
+ if self._is_stopped.isSet():
+ return
+
+ desc._set_archive_path(archive_path)
+ self._unreturned_descriptors.put(desc)
+ self._iter_notice.set()
+ except TypeError, exc:
+ self._notify_skip_listeners(target, ParsingFailure(exc))
+ except ValueError, exc:
+ self._notify_skip_listeners(target, ParsingFailure(exc))
+ finally:
+ entry.close()
except IOError, exc:
self._notify_skip_listeners(target, ReadFailed(exc))
finally:
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits