#NEWLINE# def _handle_write( self ) : #NEWLINE# #INDENT# while self . _write_buffer : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if ( not self . _write_buffer_frozen ) : #NEWLINE# #INDENT# _merge_prefix ( self . _write_buffer , ( 128 * 1024 ) ) #NEWLINE# #UNINDENT# num_bytes = self . write_to_fd ( self . _write_buffer [ 0 ] ) #NEWLINE# if ( num_bytes == 0 ) : #NEWLINE# #INDENT# self . _write_buffer_frozen = True #NEWLINE# break #NEWLINE# #UNINDENT# self . _write_buffer_frozen = False #NEWLINE# _merge_prefix ( self . _write_buffer , num_bytes ) #NEWLINE# self . _write_buffer . popleft ( ) #NEWLINE# self . _write_buffer_size -= num_bytes #NEWLINE# #UNINDENT# except ( socket . error , IOError , OSError ) as e : #NEWLINE# #INDENT# if ( e . args [ 0 ] in _ERRNO_WOULDBLOCK ) : #NEWLINE# #INDENT# self . _write_buffer_frozen = True #NEWLINE# break #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( e . args [ 0 ] not in _ERRNO_CONNRESET ) : #NEWLINE# #INDENT# gen_log . warning ( 'Write error on %s: %s' , self . fileno ( ) , e ) #NEWLINE# #UNINDENT# self . close ( exc_info = True ) #NEWLINE# return #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( not self . _write_buffer ) : #NEWLINE# #INDENT# if self . _write_callback : #NEWLINE# #INDENT# callback = self . _write_callback #NEWLINE# self . _write_callback = None #NEWLINE# self . _run_callback ( callback ) #NEWLINE# #UNINDENT# if self . _write_future : #NEWLINE# #INDENT# future = self . _write_future #NEWLINE# self . _write_future = None #NEWLINE# future . set_result ( None )