[tor-commits] [stem/master] Stop waiting for HS publication when it fails

atagar at torproject.org atagar at torproject.org
Mon May 11 19:37:19 UTC 2015


commit 4d1771cfff7117da3f3b2d9a304755d966613372
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon May 11 12:37:39 2015 -0700

    Stop waiting for HS publication when it fails
    
    Our create_ephemeral_hidden_service()'s await_publication option didn't account
    for all requests failing.
---
 stem/control.py |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index fc86909..44a0b7d 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -2673,16 +2673,21 @@ class Controller(BaseController):
       # to just guess that if it's for the same hidden service authority then
       # it's what we're looking for.
 
-      authorities_uploaded_to = []
+      directories_uploaded_to, failures = [], []
 
       try:
         while True:
           event = hs_desc_queue.get()
 
           if event.action == stem.HSDescAction.UPLOAD and event.address == response.service_id:
-            authorities_uploaded_to.append(event.directory_fingerprint)
-          elif event.action == stem.HSDescAction.UPLOADED and event.directory_fingerprint in authorities_uploaded_to:
+            directories_uploaded_to.append(event.directory_fingerprint)
+          elif event.action == stem.HSDescAction.UPLOADED and event.directory_fingerprint in directories_uploaded_to:
             break  # successfully uploaded to a HS authority... maybe
+          elif event.action == stem.HSDescAction.FAILED and event.directory_fingerprint in directories_uploaded_to:
+            failures.append('%s (%s)' % (event.directory_fingerprint, event.reason))
+
+            if len(directories_uploaded_to) == len(failures):
+              raise stem.OperationFailed(message = 'Failed to upload our hidden service descriptor to %s' % ', '.join(failures))
       finally:
         self.remove_event_listener(hs_desc_listener)
 



More information about the tor-commits mailing list