#NEWLINE# def _work( self ) : #NEWLINE# #INDENT# while self . active : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( data , addrinfo ) = self . _recv ( ) #NEWLINE# #UNINDENT# except ( socket . error , socket . timeout ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# ( magic , cmd , args ) = brine . load ( data ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( magic != 'RPYC' ) : #NEWLINE# #INDENT# self . logger . warn ( 'invalid magic: %r' , magic ) #NEWLINE# continue #NEWLINE# #UNINDENT# cmdfunc = getattr ( self , ( 'cmd_%s' % ( cmd . lower ( ) , ) ) , None ) #NEWLINE# if ( not cmdfunc ) : #NEWLINE# #INDENT# self . logger . warn ( 'unknown command: %r' , cmd ) #NEWLINE# continue #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# reply = cmdfunc ( addrinfo [ 0 ] , * args ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# self . logger . exception ( 'error executing function' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _send ( brine . dump ( args ) , addrinfo )