summaryrefslogtreecommitdiff
path: root/kafka/conn.py
diff options
context:
space:
mode:
authorMahendra M <mahendra.m@gmail.com>2013-06-27 17:47:26 +0530
committerMahendra M <mahendra.m@gmail.com>2013-06-27 17:47:26 +0530
commitb3fece508dff6a4fe8c31bc7c2282c114676646b (patch)
treeeca2dcb39888fa9d2d826ac5cab165562ba202b6 /kafka/conn.py
parentd6d7299b7dc00f852014e34df060de9268eddfae (diff)
downloadkafka-python-b3fece508dff6a4fe8c31bc7c2282c114676646b.tar.gz
Re-init the sockets in the new process
Diffstat (limited to 'kafka/conn.py')
-rw-r--r--kafka/conn.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/kafka/conn.py b/kafka/conn.py
index fce1fdc..01975e4 100644
--- a/kafka/conn.py
+++ b/kafka/conn.py
@@ -86,3 +86,12 @@ class KafkaConnection(local):
def close(self):
"Close this connection"
self._sock.close()
+
+ def reinit(self):
+ """
+ Re-initialize the socket connection
+ """
+ self._sock.close()
+ self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ self._sock.connect((self.host, self.port))
+ self._sock.settimeout(10)