[Pkg-privacy-commits] [onionshare] 157/256: Add an Onion exception for canceling connecting Tor

Ulrike Uhlig ulrike at moszumanska.debian.org
Fri May 26 12:53:32 UTC 2017


This is an automated email from the git hooks/post-receive script.

ulrike pushed a commit to branch master
in repository onionshare.

commit 6c02984a9808d8b3801c66f19addcffce02e5a7e
Author: Micah Lee <micah at micahflee.com>
Date:   Mon Apr 17 20:49:06 2017 -0700

    Add an Onion exception for canceling connecting Tor
---
 onionshare/onion.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/onionshare/onion.py b/onionshare/onion.py
index d81f23d..f5f8954 100644
--- a/onionshare/onion.py
+++ b/onionshare/onion.py
@@ -19,7 +19,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
 from stem.control import Controller
-from stem import ProtocolError
+from stem import ProtocolError, SocketClosed
 from stem.connection import MissingPassword, UnreadableCookieFile, AuthenticationFailure
 import os, sys, tempfile, shutil, urllib, platform, subprocess, time, shlex
 
@@ -99,6 +99,12 @@ class BundledTorTimeout(Exception):
     but Tor doesn't finish connecting promptly.
     """
 
+class BundledTorCanceled(Exception):
+    """
+    This exception is raised if onionshare is set to use the bundled Tor binary,
+    and the user cancels connecting to Tor
+    """
+
 class Onion(object):
     """
     Onion is an abstraction layer for connecting to the Tor control port and
@@ -197,7 +203,11 @@ class Onion(object):
                 self.c.authenticate()
 
             while True:
-                res = self.c.get_info("status/bootstrap-phase")
+                try:
+                    res = self.c.get_info("status/bootstrap-phase")
+                except SocketClosed:
+                    raise BundledTorCanceled()
+
                 res_parts = shlex.split(res)
                 progress = res_parts[2].split('=')[1]
                 summary = res_parts[4].split('=')[1]

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onionshare.git



More information about the Pkg-privacy-commits mailing list