[Pkg-privacy-commits] [onionshare] 23/33: catch exceptions when cleaning up hidden services
Ximin Luo
infinity0 at debian.org
Mon Oct 19 14:15:42 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch debian
in repository onionshare.
commit 0350cb3cdca2a013cba7ec4cae1068aaee0896d8
Author: Micah Lee <micah at micahflee.com>
Date: Tue Jun 16 12:33:56 2015 -0700
catch exceptions when cleaning up hidden services
---
onionshare/onionshare.py | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/onionshare/onionshare.py b/onionshare/onionshare.py
index e08b1a6..d29b09c 100644
--- a/onionshare/onionshare.py
+++ b/onionshare/onionshare.py
@@ -67,19 +67,25 @@ class OnionShare(object):
self.cleanup_filenames = []
def cleanup(self):
- if self.controller:
- # Get fresh hidden services (maybe changed since last time)
- # and remove ourselves
- hsdic = self.controller.get_conf_map('HiddenServiceOptions') or {
- 'HiddenServiceDir': [], 'HiddenServicePort': []
- }
- if self.hidserv_dir and self.hidserv_dir in hsdic.get('HiddenServiceDir', []):
- dropme = hsdic['HiddenServiceDir'].index(self.hidserv_dir)
- del hsdic['HiddenServiceDir'][dropme]
- del hsdic['HiddenServicePort'][dropme]
- self.controller.set_options(hsdic2list(hsdic))
- # Politely close the controller
- self.controller.close()
+ # cleanup hidden service
+ try:
+ if self.controller:
+ # Get fresh hidden services (maybe changed since last time)
+ # and remove ourselves
+ hsdic = self.controller.get_conf_map('HiddenServiceOptions') or {
+ 'HiddenServiceDir': [], 'HiddenServicePort': []
+ }
+ if self.hidserv_dir and self.hidserv_dir in hsdic.get('HiddenServiceDir', []):
+ dropme = hsdic['HiddenServiceDir'].index(self.hidserv_dir)
+ del hsdic['HiddenServiceDir'][dropme]
+ del hsdic['HiddenServicePort'][dropme]
+ self.controller.set_options(hsdic2list(hsdic))
+ # Politely close the controller
+ self.controller.close()
+ except:
+ pass
+
+ # cleanup files
for filename in self.cleanup_filenames:
if os.path.isfile(filename):
os.remove(filename)
--
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