diff options
author | Mahendra M <mahendra.m@gmail.com> | 2013-06-27 17:47:26 +0530 |
---|---|---|
committer | Mahendra M <mahendra.m@gmail.com> | 2013-06-27 17:47:26 +0530 |
commit | b3fece508dff6a4fe8c31bc7c2282c114676646b (patch) | |
tree | eca2dcb39888fa9d2d826ac5cab165562ba202b6 /kafka/conn.py | |
parent | d6d7299b7dc00f852014e34df060de9268eddfae (diff) | |
download | kafka-python-b3fece508dff6a4fe8c31bc7c2282c114676646b.tar.gz |
Re-init the sockets in the new process
Diffstat (limited to 'kafka/conn.py')
-rw-r--r-- | kafka/conn.py | 9 |
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) |