#NEWLINE# def run( self ) : #NEWLINE# #INDENT# while self . goOn : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( raw , conn ) = self . socket_handler . recvfrom ( self . BUFSIZE ) #NEWLINE# #UNINDENT# except socket . error as err : #NEWLINE# #INDENT# log . critical ( 'socket error: {0}' . format ( err ) ) #NEWLINE# self . goOn = False #NEWLINE# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not raw ) : #NEWLINE# #INDENT# log . error ( 'no data read from socket, stopping' ) #NEWLINE# self . goOn = False #NEWLINE# continue #NEWLINE# #UNINDENT# if ( not self . goOn ) : #NEWLINE# #INDENT# log . warning ( 'goOn is false' ) #NEWLINE# continue #NEWLINE# #UNINDENT# timestamp = time . time ( ) #NEWLINE# source = ( conn [ 0 ] , conn [ 1 ] ) #NEWLINE# data = [ ord ( b ) for b in raw ] #NEWLINE# log . debug ( 'got {2} from {1} at {0}' . format ( timestamp , source , data ) ) #NEWLINE# self . callback ( data , source , data ) #NEWLINE# #UNINDENT# #UNINDENT# self . socket_handler . close ( ) #NEWLINE# log . info ( 'teardown' )