From d2aabc8c514cb520d968e8241ec15c93bae2a0fe Mon Sep 17 00:00:00 2001 From: Tayane Fernandes Date: Wed, 11 Jan 2017 18:06:44 -0200 Subject: Close session when UploadKeyError occurs When the upload of the user key fails (i.e. Timeout), the session was being held in memory, preventing the user from trying again. Related with: #815, #889 --- service/pixelated/config/sessions.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/service/pixelated/config/sessions.py b/service/pixelated/config/sessions.py index ec5e1c0e..73c366c7 100644 --- a/service/pixelated/config/sessions.py +++ b/service/pixelated/config/sessions.py @@ -19,7 +19,7 @@ from leap.common.events import ( catalog as events ) -from pixelated.bitmask_libraries.keymanager import Keymanager +from pixelated.bitmask_libraries.keymanager import Keymanager, UploadKeyError from pixelated.adapter.mailstore import LeapMailStore from pixelated.config import leap_config from pixelated.bitmask_libraries.certs import LeapCertificate @@ -156,7 +156,12 @@ class LeapSession(object): @defer.inlineCallbacks def finish_bootstrap(self): - yield self.keymanager.generate_openpgp_key() + try: + yield self.keymanager.generate_openpgp_key() + except UploadKeyError as e: + logger.warn('{0}: {1}. Closing session for user: {2}'.format(e.__class__.__name__, e, self.account_email())) + self.close() + yield self._create_account(self.soledad, self.user_auth.uuid) self.incoming_mail_fetcher = yield self._create_incoming_mail_fetcher( self.keymanager, -- cgit v1.2.3