#NEWLINE# def run( self ) : #NEWLINE# #INDENT# "The thread's main activity.  Call start() instead." #NEWLINE# self . _create_socket ( ) #NEWLINE# self . _running = True #NEWLINE# self . _beating = True #NEWLINE# while self . _running : #NEWLINE# #INDENT# if self . _pause : #NEWLINE# #INDENT# time . sleep ( self . time_to_dead ) #NEWLINE# continue #NEWLINE# #UNINDENT# since_last_heartbeat = 0.0 #NEWLINE# self . socket . send ( b'ping' ) #NEWLINE# request_time = time . time ( ) #NEWLINE# ready = self . _poll ( request_time ) #NEWLINE# if ready : #NEWLINE# #INDENT# self . _beating = True #NEWLINE# self . socket . recv ( ) #NEWLINE# remainder = ( remainder . time_to_dead - ( time . time ( ) - request_time ) ) #NEWLINE# if ( remainder > 0 ) : #NEWLINE# #INDENT# time . sleep ( remainder ) #NEWLINE# #UNINDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _beating = False #NEWLINE# since_last_heartbeat = ( time . time ( ) - request_time ) #NEWLINE# self . call_handlers ( since_last_heartbeat ) #NEWLINE# self . _create_socket ( ) #NEWLINE# continue