#NEWLINE# def collect_stats( self ) : #NEWLINE# #INDENT# sockets = self . streamer . sockets #NEWLINE# if ( len ( sockets ) == 0 ) : #NEWLINE# #INDENT# ( yield None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fds = [ ] #NEWLINE# for ( sock , address , fd ) in sockets : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# fileno = sock . fileno ( ) #NEWLINE# #UNINDENT# except socket . error as err : #NEWLINE# #INDENT# if ( err . errno == errno . EBADF ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# fds . append ( ( address , fileno , fd ) ) #NEWLINE# #UNINDENT# total = { #NEWLINE# #INDENT# 'addresses' : [ ] , #NEWLINE# 'reads' : 0 , #NEWLINE# #UNINDENT# } #NEWLINE# for ( address , monitored_fd , fd ) in fds : #NEWLINE# #INDENT# info = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# info [ 'fd' ] = info [ 'subtopic' ] = fd #NEWLINE# info [ 'reads' ] = fd . _rstats [ monitored_fd ] #NEWLINE# total [ 'reads' ] += info [ 'reads' ] #NEWLINE# total [ 'addresses' ] . append ( address ) #NEWLINE# info [ 'address' ] = address #NEWLINE# self . _rstats [ monitored_fd ] = 0 #NEWLINE# ( yield info ) #NEWLINE# #UNINDENT# ( yield total )