#NEWLINE# def run_forever( self ) : #NEWLINE# #INDENT# self . conn . initiate_connection ( ) #NEWLINE# self . sock . sendall ( self . conn . data_to_send ( ) ) #NEWLINE# while True : #NEWLINE# #INDENT# data = self . sock . recv ( 65535 ) #NEWLINE# if ( not data ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# events = self . conn . receive_data ( data ) #NEWLINE# for event in events : #NEWLINE# #INDENT# if isinstance ( event , RequestReceived ) : #NEWLINE# #INDENT# self . request_received ( data . headers , event . stream_id ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( event , DataReceived ) : #NEWLINE# #INDENT# self . conn . reset_stream ( event . stream_id ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . sock . sendall ( self . conn . data_to_send ( ) )