From 9c8cb7dea19b9e791aed7e7ec27ea854119d6ac3 Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Thu, 7 Apr 2016 16:11:25 -0700 Subject: Add BrokerConnection.disconnected() method; update tests --- kafka/conn.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'kafka/conn.py') diff --git a/kafka/conn.py b/kafka/conn.py index cdf7a5e..92b2fd3 100644 --- a/kafka/conn.py +++ b/kafka/conn.py @@ -139,6 +139,10 @@ class BrokerConnection(object): """Return True iff socket is in intermediate connecting state.""" return self.state is ConnectionStates.CONNECTING + def disconnected(self): + """Return True iff socket is closed""" + return self.state is ConnectionStates.DISCONNECTED + def close(self, error=None): """Close socket and fail all in-flight-requests. -- cgit v1.2.1