def reinit(self):
log.debug("<STR_LIT>" % (self.host, self.port))<EOL>if self._sock:<EOL><INDENT>self.close()<EOL><DEDENT>try:<EOL><INDENT>self._sock = socket.create_connection((self.host, self.port), self.timeout)<EOL><DEDENT>except socket.error:<EOL><INDENT>log.exception('<STR_LIT>' % (self.host, self.port))<EOL>self._raise_connection_error()<EOL><DEDENT>
Re-initialize the socket connection
close current socket (if open)
and start a fresh connection
raise ConnectionError on error