diff options
author | Dana Powers <dana.powers@gmail.com> | 2017-10-14 17:21:36 -0700 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2017-10-14 17:21:36 -0700 |
commit | bbab7aadb62517464420abfd1eed771af68fd7be (patch) | |
tree | bf225c7e25c40f3d6264a35fe202c9cbd73d423d | |
parent | 15b15449562d36baa388642a00305977f4cecc15 (diff) | |
download | kafka-python-bbab7aadb62517464420abfd1eed771af68fd7be.tar.gz |
_sasl_auth_future can be reset if recv() causes disconnect
-rw-r--r-- | kafka/conn.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kafka/conn.py b/kafka/conn.py index dc15a5e..2f560d0 100644 --- a/kafka/conn.py +++ b/kafka/conn.py @@ -444,7 +444,10 @@ class BrokerConnection(object): sasl_response.add_errback(lambda f, e: f.failure(e), future) self._sasl_auth_future = future self.recv() - if self._sasl_auth_future.failed(): + # A connection error could trigger close() which will reset the future + if self._sasl_auth_future is None: + return False + elif self._sasl_auth_future.failed(): ex = self._sasl_auth_future.exception if not isinstance(ex, Errors.ConnectionError): raise ex # pylint: disable-msg=raising-bad-type |