From db569212507e283e1e03e089ac2e5628cbf9303c Mon Sep 17 00:00:00 2001 From: Jeroen van der Heijden Date: Sat, 22 Oct 2016 21:36:08 +0200 Subject: [PATCH] Fixed issue #2 --- ChangeLog | 6 +++++- setup.py | 2 +- siridb/connector/__init__.py | 3 +-- siridb/connector/lib/client.py | 4 +--- siridb/connector/lib/protocol.py | 7 ++++++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index df53ce8..f1f84eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,11 @@ +2016.10.22, Version 2.0.3 (BETA) + + - Fixed handling authentication errors correctly. (issue #2) + 2016.10.21, Version 2.0.2 (BETA) - Added is_closed property to client. - - New and closed connections logging is set from info to debug + - New and closed connections logging is set from info to debug. (issue #1) 2016.10.03, Version 2.0.1 (BETA) diff --git a/setup.py b/setup.py index c4eb6de..28f2cf6 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from distutils.core import setup import setuptools -VERSION = '2.0.2' +VERSION = '2.0.3' setup( name='siridb-connector', diff --git a/siridb/connector/__init__.py b/siridb/connector/__init__.py index 722cf79..cefdb84 100644 --- a/siridb/connector/__init__.py +++ b/siridb/connector/__init__.py @@ -8,7 +8,7 @@ from .lib.client import SiriDBClient -__version_info__ = (2, 0, 2) +__version_info__ = (2, 0, 3) __version__ = '.'.join(map(str, __version_info__)) __maintainer__ = 'Jeroen van der Heijden' __email__ = 'jeroen@transceptor.technology' @@ -20,7 +20,6 @@ 'SiriDBProtocol', ] - class SiriDBProtocol(_SiriDBProtocol): def on_connection_made(self): diff --git a/siridb/connector/lib/client.py b/siridb/connector/lib/client.py index 57c11f0..03a877d 100644 --- a/siridb/connector/lib/client.py +++ b/siridb/connector/lib/client.py @@ -169,13 +169,11 @@ def _log_connect_result(result): for r in result: if r: logging.error(r) - if isinstance(r, (IndexError, AuthenticationError)): - break async def connect(self, timeout=None): self._retry_connect = True result = await self._connect(timeout) - if result and set(result) - {None}: + if result and set(result) - {None} and self._connect_task is None: self._connect_task = asyncio.ensure_future(self._connect_loop()) return result diff --git a/siridb/connector/lib/protocol.py b/siridb/connector/lib/protocol.py index 671b740..926cb01 100644 --- a/siridb/connector/lib/protocol.py +++ b/siridb/connector/lib/protocol.py @@ -85,8 +85,13 @@ def connection_made(self, transport): override asyncio.Protocol ''' def finished(future): - if not future.exception(): + exc = future.exception() + if not exc: self.on_authenticated() + else: + logging.debug('Authentication failed: {}'.format(exc)) + self.transport.close() + self._connected = True self.transport = transport