#NEWLINE# def on_recv( self , handler , addr , data , error ) : #NEWLINE# #INDENT# with self . _lock : #NEWLINE# #INDENT# if ( addr in self . conns ) : #NEWLINE# #INDENT# conn = self . conns [ addr ] #NEWLINE# if error : #NEWLINE# #INDENT# if ( error == 1 ) : #NEWLINE# #INDENT# msg = '' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg = bomb ( IOError , IOError ( ( 'uv error: %s' % error ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# msg = data #NEWLINE# #UNINDENT# conn . queue . append ( msg ) #NEWLINE# if ( conn . cr . balance < 0 ) : #NEWLINE# #INDENT# conn . cr . send ( self . queue . popleft ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if len ( self . listeners ) : #NEWLINE# #INDENT# listener = self . listeners . popleft ( ) #NEWLINE# if error : #NEWLINE# #INDENT# listener . c . send_exception ( IOError , ( 'uv error: %s' % error ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# conn = UDPConn ( addr ) #NEWLINE# conn . queue . append ( data ) #NEWLINE# self . conns [ addr ] = conn #NEWLINE# listener . c . send ( conn , error ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . task . throw ( NoMoreListener ) #NEWLINE# #UNINDENT# #UNINDENT# schedule ( )