def run(self):
self._create_socket()<EOL>self._running = True<EOL>self._beating = True<EOL>while self._running:<EOL><INDENT>if self._pause:<EOL><INDENT>time.sleep(self.time_to_dead)<EOL>continue<EOL><DEDENT>since_last_heartbeat = <NUM_LIT:0.0><EOL>self.socket.send(b'<STR_LIT>')<EOL>request_time = time.time()<EOL>ready = self._poll(request_time)<EOL>if ready:<EOL><INDENT>self._beating = True<EOL>self.socket.recv()<EOL>remainder = self.time_to_dead - (time.time() - request_time)<EOL>if remainder > <NUM_LIT:0>:<EOL><INDENT>time.sleep(remainder)<EOL><DEDENT>continue<EOL><DEDENT>else:<EOL><INDENT>self._beating = False<EOL>since_last_heartbeat = time.time() - request_time<EOL>self.call_handlers(since_last_heartbeat)<EOL>self._create_socket()<EOL>continue<EOL><DEDENT><DEDENT>try:<EOL><INDENT>self.socket.close()<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>
The thread's main activity.  Call start() instead.